forked from TrueCloudLab/frostfs-node
[#1321] node: Register GC event channel before shard init
Morph "NewEpoch" event handling was registered in a closure over `addNewEpochNotificationHandler` func. That may lead to the data race: if a shard was initialized before the event registration, everything works as planned, but if registration was made earlier, it was not able to include GC handlers since a shard has not called `eventChanInit` yet and, therefore, it has not registered handler yet. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
d4569946c5
commit
bd27837364
4 changed files with 14 additions and 26 deletions
|
@ -38,9 +38,7 @@ func TestLockUserScenario(t *testing.T) {
|
|||
|
||||
e := testEngineFromShardOpts(t, 2, func(i int) []shard.Option {
|
||||
return []shard.Option{
|
||||
shard.WithGCEventChannelInitializer(func() <-chan shard.Event {
|
||||
return chEvents[i]
|
||||
}),
|
||||
shard.WithGCEventChannel(chEvents[i]),
|
||||
shard.WithGCWorkerPoolInitializer(func(sz int) util.WorkerPool {
|
||||
pool, err := ants.NewPool(sz)
|
||||
require.NoError(t, err)
|
||||
|
@ -136,9 +134,7 @@ func TestLockExpiration(t *testing.T) {
|
|||
|
||||
e := testEngineFromShardOpts(t, 2, func(i int) []shard.Option {
|
||||
return []shard.Option{
|
||||
shard.WithGCEventChannelInitializer(func() <-chan shard.Event {
|
||||
return chEvents[i]
|
||||
}),
|
||||
shard.WithGCEventChannel(chEvents[i]),
|
||||
shard.WithGCWorkerPoolInitializer(func(sz int) util.WorkerPool {
|
||||
pool, err := ants.NewPool(sz)
|
||||
require.NoError(t, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue