Skip to content

Commit

Permalink
update channelqueue renamed to chanqueue (#2689)
Browse files Browse the repository at this point in the history
* update channelqueue renamed to chanqueue
* update deque
  • Loading branch information
gammazero authored Nov 24, 2024
1 parent e0b6b8d commit 826e603
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion gc/reaper/reaper.go
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,8 @@ func (s *scythe) reap(ctx context.Context, latestAdCid cid.Cid) error {
}()

segSize := s.reaper.segmentSize
segment := deque.New[adInfo](segSize, segSize)
segment := new(deque.Deque[adInfo])
segment.SetBaseCap(segSize)

for segEnd := gcState.LastProcessedAdCid; segEnd != latestAdCid; {
for adCid := latestAdCid; adCid != segEnd; {
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ require (
github.com/aws/aws-sdk-go-v2/service/s3 v1.30.2
github.com/aws/smithy-go v1.13.5
github.com/cockroachdb/pebble v0.0.0-20240822181941-1b4021bcfe22
github.com/gammazero/channelqueue v0.2.2
github.com/gammazero/deque v0.2.1
github.com/gammazero/chanqueue v1.0.0
github.com/gammazero/deque v1.0.0
github.com/gammazero/targz v0.0.3
github.com/ipfs/boxo v0.24.2
github.com/ipfs/go-cid v0.4.1
Expand Down Expand Up @@ -91,6 +91,7 @@ require (
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gammazero/channelqueue v0.2.2 // indirect
github.com/gammazero/radixtree v0.3.1 // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,10 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/gammazero/channelqueue v0.2.2 h1:ufNzIbeDBxNfHj0m5uwUfOwvTmHF/O40hu2ZNnvF+/8=
github.com/gammazero/channelqueue v0.2.2/go.mod h1:824o5HHE+yO1xokh36BIuSv8YWwXW0364ku91eRMFS4=
github.com/gammazero/deque v0.2.1 h1:qSdsbG6pgp6nL7A0+K/B7s12mcCY/5l5SIUpMOl+dC0=
github.com/gammazero/deque v0.2.1/go.mod h1:LFroj8x4cMYCukHJDbxFCkT+r9AndaJnFMuZDV34tuU=
github.com/gammazero/chanqueue v1.0.0 h1:FER/sMailGFA3DDvFooEkipAMU+3c9Bg3bheloPSz6o=
github.com/gammazero/chanqueue v1.0.0/go.mod h1:fMwpwEiuUgpab0sH4VHiVcEoji1pSi+EIzeG4TPeKPc=
github.com/gammazero/deque v1.0.0 h1:LTmimT8H7bXkkCy6gZX7zNLtkbz4NdS2z8LZuor3j34=
github.com/gammazero/deque v1.0.0/go.mod h1:iflpYvtGfM3U8S8j+sZEKIak3SAKYpA5/SQewgfXDKo=
github.com/gammazero/radixtree v0.3.1 h1:kYVZUH/XgIktiGjUBERExxP6Ock7epWuCAlrB2FKsmk=
github.com/gammazero/radixtree v0.3.1/go.mod h1:wcCpc8wCLVlPg2FVRYQLtBCnj9MNHQI1qB1hVrHvEDs=
github.com/gammazero/targz v0.0.3 h1:vlODyfU9QdRgD1AgdEgLQ7lhg+rc4eDQVoSoMoC1ruc=
Expand Down
4 changes: 2 additions & 2 deletions internal/ingest/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"sync/atomic"
"time"

"github.com/gammazero/channelqueue"
"github.com/gammazero/chanqueue"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/query"
Expand Down Expand Up @@ -587,7 +587,7 @@ func (ing *Ingester) onAdProcessed(peerID peer.ID) (<-chan adProcessedEvent, con
// before being read. If this channel blocked and then caused
// distributeEvents to block, that could prevent this channel from being
// read, causing deadlock.
cq := channelqueue.New[adProcessedEvent](-1)
cq := chanqueue.New[adProcessedEvent]()
events := cq.In()
cancel := func() {
// Drain channel to prevent deadlock if blocked writes are preventing
Expand Down

0 comments on commit 826e603

Please sign in to comment.