added queue optimizations and depth monitoring.

This commit is contained in:
Jay
2026-05-08 14:47:28 -04:00
parent c87a8cce6f
commit 56c2539249
5 changed files with 21 additions and 9 deletions
+3 -3
View File
@@ -18,7 +18,7 @@ func TestRunQueue(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
go RunQueue(id, ctx, inChan, outChan, 0, &atomic.Uint64{})
go RunQueue(id, ctx, inChan, outChan, 0, &atomic.Uint64{}, &atomic.Int64{})
inChan <- types.ReceivedMessage{Data: []byte("hello"), ReceivedAt: time.Now()}
@@ -50,7 +50,7 @@ func TestRunQueue(t *testing.T) {
}
}()
go RunQueue(id, ctx, inChan, gatedInbox, 2, &atomic.Uint64{})
go RunQueue(id, ctx, inChan, gatedInbox, 2, &atomic.Uint64{}, &atomic.Int64{})
// send three messages while the gated inbox is blocked
inChan <- types.ReceivedMessage{Data: []byte("first"), ReceivedAt: time.Now()}
@@ -88,7 +88,7 @@ func TestRunQueue(t *testing.T) {
done := make(chan struct{})
go func() {
RunQueue(id, ctx, inChan, outChan, 0, &atomic.Uint64{})
RunQueue(id, ctx, inChan, outChan, 0, &atomic.Uint64{}, &atomic.Int64{})
close(done)
}()