ntfy/util
Nick Farrell 09e8fb81b5
Accumulate incoming messages in a buffered channel
Instead of using a deque, store incoming messages in a native
buffered channel, if buffering is enabled.

In addition, modify the batching algorithm so the enforced delay
between consecutive `addMessages` invocations is applied after
all pending messages are processed. This acts as a "cooldown", rather
than a "warmup". This avoids the need for more complex timing logic to
dispatch batches, removes latency in adding messages when received
infrequently, and natively blocking the goroutine until messages are
received.

Because the message processing loop always performs a blocking read
first, it is appropriate for low-throughput environments just as much as
high-throughput ones.

The default value of batchSize has been changed to 10, with a zero
cooldown. This means that when messages are arriving faster than they
can be inserted into sqlite, they will automatically become batched in
groups of up to 10.
2022-12-23 08:30:47 +11:00
..
embedfs Webhooks (#55), more tests (#35) and python examples (#50) 2021-12-15 16:12:40 -05:00
content_type_writer.go Better mime type probing 2022-01-10 13:38:51 -05:00
content_type_writer_test.go Fix randomly failing test 2022-05-07 19:42:36 -04:00
embedfs.go Reformatting, make update 2022-09-27 12:37:02 -04:00
embedfs_test.go Webhooks (#55), more tests (#35) and python examples (#50) 2021-12-15 16:12:40 -05:00
gzip_handler.go Replace interface{} 2022-10-01 16:31:48 -04:00
gzip_handler_test.go Gzip static responses 2022-03-10 21:55:56 -05:00
limit.go Add test 2022-04-03 20:19:43 -04:00
limit_test.go Making RateLimiter and FixedLimiter, so they can both work with LimitWriter 2022-01-12 17:03:28 -05:00
peek.go Docs and Matrix tests 2022-06-16 11:40:56 -04:00
peek_test.go Attachment behavior fix for Firefox 2022-04-03 12:39:52 -04:00
time.go Docs docs docs 2021-12-11 00:06:25 -05:00
time_test.go Lots more tests 2021-12-10 22:57:01 -05:00
util.go recommended fixes [1 of 2] 2022-10-07 16:17:04 -05:00
util_test.go test ContainsIP utility 2022-10-07 21:22:22 -05:00