Forked from mort/Fighting notification flood with the alea gem
Last active
January 26, 2017 17:32
-
-
Save aitor/475265 to your computer and use it in GitHub Desktop.
Fighting notification flood with the alea gem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Activity streams' notifications to third parties are cool because they bring | |
# a feeling of a shared public space and increase the chance 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