fix: improve paging and subscriptions

This commit is contained in:
Jon Lundy
2022-08-10 10:09:58 -06:00
parent 0642879c07
commit 72e7d5f265
11 changed files with 118 additions and 81 deletions

View File

@@ -2,7 +2,6 @@ package locker
import (
"context"
"log"
)
type Locked[T any] struct {
@@ -26,9 +25,6 @@ func (s *Locked[T]) Modify(ctx context.Context, fn func(*T) error) error {
select {
case state := <-s.state:
defer func() { s.state <- state }()
log.Printf("locker %T to %p", state, fn)
defer log.Printf("locker %T from %p", state, fn)
return fn(state)
case <-ctx.Done():
return ctx.Err()