Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mort/475247 to your computer and use it in GitHub Desktop.
Save mort/475247 to your computer and use it in GitHub Desktop.
# Activity streams' notifications to third parties are cool because they bring a feeling of a shared public space and increase the chance of serendipitous findings
# But too much information quickly becomes noise, and relevant bits of news can disappear among a tsunami of irrelevant (to me) "x did y with z'
# What we're trying to do here is going from deterministic notifications (stuff happens, stuff gets broadcasted) to stochastic ones (stuff happens, stuff may gets broadcasted)
# Thanks to the fantastic alea gem (http://github.com/linkingpaths/alea) by Linking Paths, the explanation is way longer than this very naive one liner implementation.
# TO-DO: experiment with varying the probabilities based on time thresholds (i.e. 100 similar notifications (same type / same originating user) in one hour have a 1% chance of showing up, 1 single notification in one hour has 100% chances of showing up)
def do_probabilistic_broadcast
# Always notify you of activity around your stuff
notify_owner
# Don't flood your peers with too much info
maybe(60.percent) { notify_peers }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment