Commit Graph

23 Commits

Author SHA1 Message Date
James Mills 14a6294f27 Fix off-by-one error in Queue.ForEach() (#41)
Fixes #40 and salty.im#24 🤞

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/prologic/msgbus/pulls/41
Reviewed-by: xuu <xuu@noreply@mills.io>
2023-04-23 01:59:40 +00:00
James Mills 01ab56f9b3 Fix Subscribe() deadlock (#34)
Fixes #139

This was caused by full subscriber buffers.

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/prologic/msgbus/pulls/34
2022-04-04 01:15:49 +00:00
James Mills 6bfb669347 Add support for a write-ahead-log (WAL) to persist messages (#33)
Closes #31

Adds support for a write-ahead-log (WAL) for messages per queue/topic. This is now the new default behaviour and adds a new CLI flag `-l/--log-path` and Env var `LOG_PATH` to configure where the logs are stored.

On startup, the message bus will refill the queues with the contents of messages from persisted log files with the most recent `-Q/--max-queue-size` number of items.

That is, on startup/crash the queues/topics will always contain the same messages as if the message bus had never restarted or crashed in the first place.

This has a benefit of actually making the per-topic sequence number _actually_ monotic increasing integers and something that can be relied upon when indexing into a queue/topic for subscribers with the `-i/--index` / `Index` option.

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/prologic/msgbus/pulls/33
2022-04-03 15:59:38 +00:00
James Mills 7b71102aa8 Add support for subscribers to start from an index (#26)
Closes #20

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Co-authored-by: xuu <xuu@noreply@mills.io>
Reviewed-on: https://git.mills.io/prologic/msgbus/pulls/26
2022-04-02 14:05:15 +00:00
James Mills 4bbe613486
Fix Reconnect test 2022-04-02 14:19:17 +10:00
James Mills f51416382c
Use require.NoError() to assert errors 2022-04-02 14:16:49 +10:00
James Mills 929cfd3a36
Fix response for empty topic/queue by responding with HTTP 204 No Content instead of 404 Not Found (Fixes #25) 2022-03-31 20:55:03 +10:00
James Mills 3f72ec8444
Partially unrevert 6a840a2 2022-03-27 14:47:14 +10:00
James Mills 6a840a26b4
Revert "change gorilla/websocket to nhooyr.io/websocket"
This reverts commit ec8dbec632.
2022-03-27 12:42:56 +10:00
nilsocket ec8dbec632
change gorilla/websocket to nhooyr.io/websocket 2022-03-26 23:15:34 +05:30
James Mills 5827535f6d
Fixed GET / (topics) test 2018-05-14 03:25:00 -07:00
James Mills 400702b2b4
Added more tests 2018-05-14 03:12:07 -07:00
James Mills c640130f11
Improve API to be more RESTful 2018-05-14 03:04:45 -07:00
James Mills 81e35b8e18
Fixes several performance issues found in profiling and load testing. (#12)
* Fixed drop rate for subscriber listeners by adding buffering to channels (configurable)

* Added optinoal pprof support

* Added profile target for running profiled benchmarks
2018-05-14 02:12:58 -07:00
James Mills 17a205e7f7
Added test for max-payload-size 2018-05-11 00:41:52 -07:00
James Mills 0e2ca09072
Add MsgBus.Metrics() test (#8) 2018-05-11 00:09:58 -07:00
James Mills 60dd187cdd
Improves test coverage (#7)
* Added GET / (empty) test

* Added POST /hello test

* Added PUT /hello test

* Added simple e2e test (POST & GET)

* Add Subscriber test (fixed some race conditions)
2018-05-10 02:46:25 -07:00
Alexander Emelin 22efa3afc8 use New instead of NewMessageBus for main message bus constructor (#5)
* use New instead of NewMessageBus for main message bus constructor

* update readme: New as message bus constructor
2018-05-08 01:50:56 -07:00
James Mills 5b1f84bf40
Add more tests and bench target 2018-04-06 23:34:51 -07:00
James Mills 31e672a2d0
Fixed benchmark tests 2018-03-03 19:42:50 +00:00
James Mills e5a771bae3
Fixed tests 2017-08-19 18:26:15 -07:00
James Mills 9fbbee7d96
Fixed tests 2017-08-10 00:30:45 -07:00
James Mills 537969e9f2
Initial Commit 2017-06-03 16:16:17 +01:00