Skip to content

Commit

Permalink
[kit] fix SingleFlight signature
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsannm committed Nov 15, 2023
1 parent 8dfc5e5 commit ccb1873
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kit/utils/singleflight.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type SingleFlightCall[T any] func(fn func() (T, error)) (T, error)
// time. If a duplicate comes in, the duplicate caller waits for the
// original to complete and receives the same results.
// The return value shared indicates whether v was given to multiple cal
func SingleFlight[T any](_ func() (T, error)) SingleFlightCall[T] {
func SingleFlight[T any]() SingleFlightCall[T] {
mu := sync.Mutex{}
var (
c *call
Expand Down
2 changes: 1 addition & 1 deletion kit/utils/singleflight_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestSingleFlight(t *testing.T) {
return "hello", nil
}

sf := utils.SingleFlight(fn)
sf := utils.SingleFlight[string]()

wg := sync.WaitGroup{}
for j := 0; j < 10; j++ {
Expand Down

0 comments on commit ccb1873

Please sign in to comment.