Commit 9cba2609 authored by Alan Szlosek's avatar Alan Szlosek

clarify digest module comments

parent c1ae1865
Purpose: To help you control the number of messages/alerts that are delivered
What does this module do?
So you can roll up messages and deliver at 0:00, 0:05, 0:10 (every 5 minutes). Not sure the correct name for this sort of scheduling.
It gives you a way to queue messages up for delivery in a batch. So you can roll up messages and deliver at 0:00, 0:05, 0:10 (every 5 minutes). You specify a regex pattern to compare against an ISO-8601 date. If the pattern matches, the messages are passed along to the deliveryCallback.
TODO: this is still a bit clunky.
Each Digest instance is a delivery scheduler
You can roll up multiple message ids into this same schedule
Digest.toSeconds(seconds modulo)
// Prelim digest module. Replaces throttling in the short term
Valid intervals, for now:
1 second
5 second
10 second
30 second
1 minute
5 minute
10 minute
30 minute
1 hour
// Think I want to let devs specify their own method for rolling up messages
// Maybe our default will be a line with the message id, followed by a count of those rolled up
......@@ -99,6 +83,10 @@ Digest.prototype.add = function(id, message) {
// Only push up to our recentCacheSize
if (this.cache[id].length > this.cacheSize) {
this.cache[id].splice(0, this.cache[id].length - this.cacheSize);
Digest.prototype.stop = function() {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment