cadence icon indicating copy to clipboard operation
cadence copied to clipboard

Check all usage of context.Background()

Open yycptt opened this issue 3 years ago • 0 comments

context.Background() is used in our codebase when making rpc calls, persistence requests, or waiting for some other components. Those usages may be dangerous as they may potentially be blocking and hang for a long time. During service shutdown, we may also get blocked on those places.

It will be good if we can check all usage of context.Background() and see if they make sense or not. And see if we can replace them with a child context that is derived from a root context, which can be cancelled on service shutdown.

A example can be found in this pr: https://github.com/uber/cadence/pull/4662

yycptt avatar Dec 01 '21 23:12 yycptt