[#9999] writecache: Fix after revert
Some checks failed
Tests and linters / Run gofumpt (pull_request) Successful in 30s
DCO action / DCO (pull_request) Failing after 40s
Vulncheck / Vulncheck (pull_request) Successful in 54s
Build / Build Components (pull_request) Successful in 1m25s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m28s
Tests and linters / Staticcheck (pull_request) Successful in 2m1s
Tests and linters / Tests (pull_request) Successful in 2m9s
Tests and linters / gopls check (pull_request) Successful in 2m24s
Tests and linters / Lint (pull_request) Successful in 2m42s
Tests and linters / Tests with -race (pull_request) Successful in 2m56s
Some checks failed
Tests and linters / Run gofumpt (pull_request) Successful in 30s
DCO action / DCO (pull_request) Failing after 40s
Vulncheck / Vulncheck (pull_request) Successful in 54s
Build / Build Components (pull_request) Successful in 1m25s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m28s
Tests and linters / Staticcheck (pull_request) Successful in 2m1s
Tests and linters / Tests (pull_request) Successful in 2m9s
Tests and linters / gopls check (pull_request) Successful in 2m24s
Tests and linters / Lint (pull_request) Successful in 2m42s
Tests and linters / Tests with -race (pull_request) Successful in 2m56s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
6e4b75b5f9
commit
d0592df3c1
7 changed files with 24 additions and 21 deletions
|
@ -109,14 +109,14 @@ func (c *cache) Open(_ context.Context, mod mode.Mode) error {
|
|||
// Init runs necessary services.
|
||||
func (c *cache) Init(ctx context.Context) error {
|
||||
c.metrics.SetMode(mode.ConvertToComponentModeDegraded(c.mode))
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
c.cancel.Store(cancel)
|
||||
c.runFlushLoop(ctx)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close closes db connection and stops services. Executes ObjectCounters.FlushAndClose op.
|
||||
func (c *cache) Close(ctx context.Context) error {
|
||||
func (c *cache) Close(_ context.Context) error {
|
||||
if cancelValue := c.cancel.Swap(dummyCanceler); cancelValue != nil {
|
||||
cancelValue.(context.CancelFunc)()
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ func (c *cache) Close(ctx context.Context) error {
|
|||
|
||||
var err error
|
||||
if c.db != nil {
|
||||
err = c.db.Close(ctx)
|
||||
err = c.db.Close()
|
||||
if err != nil {
|
||||
c.db = nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue