queue: include send time in messages

This commit is contained in:
2025-04-20 13:55:36 -04:00
parent 0928197781
commit 7cc4482965
3 changed files with 22 additions and 8 deletions

View File

@@ -18,6 +18,9 @@ type Message struct {
Channel string `json:"ch"`
// Sender is an obfuscated identifier for the sending user.
Sender sender `json:"u"`
// Timestamp is the time at which the message was sent in nanoseconds since
// the Unix epoch.
Timestamp int64 `json:"ts"`
// Text is the message content.
Text string `json:"t"`
}

View File

@@ -21,10 +21,11 @@ func (p *spyProducer) Produce(ctx context.Context, rec *kgo.Record, promise func
func TestSend(t *testing.T) {
msg := queue.Message{
ID: "bocchi",
Channel: "kessoku",
Sender: queue.Sender(make([]byte, 16), "kessoku", "ryō"),
Text: "bocchi the rock!",
ID: "bocchi",
Channel: "kessoku",
Sender: queue.Sender(make([]byte, 16), "kessoku", "ryō"),
Timestamp: 1,
Text: "bocchi the rock!",
}
var q spyProducer
errs := make(chan error, 1)