dataloader icon indicating copy to clipboard operation
dataloader copied to clipboard

NoCache option doesn't seems to work in v6.0.0

Open zdraganov opened this issue 2 years ago • 3 comments

Hello all,

I receive a panic when using the loader with the NoCache option. The same code works fine with InMemoryCache passed or by default.

Anyone managed to make the NoCache working in v6.0.0

ctx = context.WithValue(ctx, k, dataloader.NewBatchedLoader(helloBatchFunction, dataloader.WithCache(&dataloader.NoCache{})))

And the time I invoke the Load(ctx, key) function, I receive some internal panic in the dataloader package.

panic({0x18b7660, 0x277de20})
/usr/local/go/src/runtime/panic.go:844 +0x264
github.com/myorg/myrepo/internal/loader.(*pairsTournamentLoader).loadBatch(0x40006b3380, {0x1c5e9c8, 0x4000daed20}, {0x4000dac9c0, 0x3, 0x4})
/app/internal/loader/hello_loader.go:73 +0x600
github.com/graph-gophers/dataloader.(*batcher).batch.func1(0x4000de8df0, 0x4000daeea0, {0x1c5e9c8, 0x4000daed20}, {0x4000dac9c0, 0x3, 0x4}, 0x4000f29e80)
/go/pkg/mod/github.com/graph-gophers/[email protected]+incompatible/dataloader.go:432 +0xb4
github.com/graph-gophers/dataloader.(*batcher).batch(0x4000daeea0, {0x1c5e9c8, 0x4000daed20})
/go/pkg/mod/github.com/graph-gophers/[email protected]+incompatible/dataloader.go:433 +0x320
created by github.com/graph-gophers/dataloader.(*Loader).Load
/go/pkg/mod/github.com/graph-gophers/[email protected]+incompatible/dataloader.go:241 +0x568

zdraganov avatar Nov 01 '22 13:11 zdraganov

Having same issue

mgreer avatar Mar 22 '23 18:03 mgreer

Please, don't use context for storage DataLoader. It's not good way.

Can u write some example for check your problem ? Because in example https://github.com/graph-gophers/dataloader/blob/v6.0.0/example/no_cache/no_cache_test.go all work fine.

eaglemoor avatar Apr 03 '23 10:04 eaglemoor

Same issue here

zenyui avatar Jul 20 '23 02:07 zenyui