moved buffer closer to its usage in Firehose

This commit is contained in:
pippellia-btc
2025-09-19 15:56:07 +02:00
parent 7d8907984d
commit 1de9a84ba3
2 changed files with 22 additions and 23 deletions

View File

@@ -7,7 +7,6 @@ import (
"log"
"os"
"os/signal"
"slices"
"syscall"
"github.com/nbd-wtf/go-nostr"
@@ -73,25 +72,3 @@ func shutdown(pool *nostr.SimplePool) {
return true
})
}
type buffer struct {
IDs []string
capacity int
write int
}
func newBuffer(capacity int) *buffer {
return &buffer{
IDs: make([]string, capacity),
capacity: capacity,
}
}
func (b *buffer) Add(ID string) {
b.IDs[b.write] = ID
b.write = (b.write + 1) % b.capacity
}
func (b *buffer) Contains(ID string) bool {
return slices.Contains(b.IDs, ID)
}