[#1437] node: Fix contextcheck linter

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-10-21 16:27:28 +03:00
parent 6921a89061
commit 7429553266
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0
209 changed files with 1068 additions and 1036 deletions

View file

@ -98,19 +98,19 @@ func (c *cache) Open(_ context.Context, mod mode.Mode) error {
}
// Init runs necessary services.
func (c *cache) Init() error {
func (c *cache) Init(ctx context.Context) error {
c.metrics.SetMode(mode.ConvertToComponentModeDegraded(c.mode))
if err := c.flushAndDropBBoltDB(context.Background()); err != nil {
if err := c.flushAndDropBBoltDB(ctx); err != nil {
return fmt.Errorf("flush previous version write-cache database: %w", err)
}
ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithCancel(context.WithoutCancel(ctx)) // canceling performed by cache
c.cancel.Store(cancel)
c.runFlushLoop(ctx)
return nil
}
// Close closes db connection and stops services. Executes ObjectCounters.FlushAndClose op.
func (c *cache) Close() error {
func (c *cache) Close(ctx context.Context) error {
if cancelValue := c.cancel.Swap(dummyCanceler); cancelValue != nil {
cancelValue.(context.CancelFunc)()
}
@ -127,7 +127,7 @@ func (c *cache) Close() error {
var err error
if c.fsTree != nil {
err = c.fsTree.Close()
err = c.fsTree.Close(ctx)
if err != nil {
c.fsTree = nil
}