@@ -399,12 +399,17 @@ func (collection *ResourceCollection) Watch(ctx context.Context, id resource.ID,
399399 }
400400
401401 if collection .writePos - pos > int64 (collection .capacity ) {
402+ collectionWritePos , collectionCapacity := collection .writePos , collection .capacity
403+
402404 collection .mu .Unlock ()
403405
404406 channel .SendWithContext (ctx , ch ,
405407 state.Event {
406- Type : state .Errored ,
407- Error : fmt .Errorf ("buffer overrun: namespace %q type %q" , collection .ns , collection .typ ),
408+ Type : state .Errored ,
409+ Error : fmt .Errorf (
410+ "buffer overrun: namespace %q type %q, write pos %d, pos %d, capacity %d" ,
411+ collection .ns , collection .typ , collectionWritePos , pos , collectionCapacity ,
412+ ),
408413 },
409414 )
410415
@@ -608,11 +613,16 @@ func (collection *ResourceCollection) WatchAll(ctx context.Context, singleCh cha
608613 }
609614
610615 if collection .writePos - pos > int64 (collection .capacity ) {
616+ collectionWritePos , collectionCapacity := collection .writePos , collection .capacity
617+
611618 collection .mu .Unlock ()
612619
613620 overrunEvent := state.Event {
614- Type : state .Errored ,
615- Error : fmt .Errorf ("buffer overrun: namespace %q type %q" , collection .ns , collection .typ ),
621+ Type : state .Errored ,
622+ Error : fmt .Errorf (
623+ "buffer overrun: namespace %q type %q, write pos %d, pos %d, capacity %d" ,
624+ collection .ns , collection .typ , collectionWritePos , pos , collectionCapacity ,
625+ ),
616626 }
617627
618628 switch {
0 commit comments