optimizely / go-sdk

Go SDK for Optimizely Feature Experimentation and Optimizely Full Stack (legacy)
https://docs.developers.optimizely.com/experimentation/v4.0-full-stack/docs/go-sdk
Apache License 2.0
18 stars 19 forks source link

[FSSDK-8501] fix: gracefully close client to dispatch queued events #376

Closed pulak-opti closed 1 year ago

pulak-opti commented 1 year ago

Ticket: FSSDK-8501

yasirfolio3 commented 1 year ago

Are we sure we need this change? I think this is already part of sdk implementation, this test also verifies it: https://github.com/optimizely/go-sdk/blob/master/pkg/event/processor_test.go#L348 unless we are trying something else here? eg.TerminateAndWait() makes sure all events are dispatched before close is completed.

pulak-opti commented 1 year ago

Are we sure we need this change? I think this is already part of sdk implementation, this test also verifies it: https://github.com/optimizely/go-sdk/blob/master/pkg/event/processor_test.go#L348 unless we are trying something else here? eg.TerminateAndWait() makes sure all events are dispatched before close is completed.

Actually, this is the go routine https://github.com/optimizely/go-sdk/blob/master/pkg/event/dispatcher.go#L99 which fails to finish dispatching all queued events for a sudden client.Close()

and this is called here https://github.com/optimizely/go-sdk/blob/master/pkg/event/processor.go#L323