Skip to content

Commit

Permalink
Merge pull request #629 from anyproto/go-2355-anytype-helper-crashed-…
Browse files Browse the repository at this point in the history
…03517-beta

GO-2355: Don't wait for slow services to close
  • Loading branch information
deff7 authored Nov 13, 2023
2 parents 977d1d2 + f1d3504 commit 3752072
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 8 additions & 4 deletions core/filestorage/filesync/filesync.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,15 @@ func (f *fileSync) Close(ctx context.Context) (err error) {
if f.loopCancel != nil {
f.loopCancel()
}
if closer, ok := f.rpcStore.(io.Closer); ok {
if err = closer.Close(); err != nil {
log.Error("can't close rpc store", zap.Error(err))
// Don't wait
go func() {
if closer, ok := f.rpcStore.(io.Closer); ok {
if err = closer.Close(); err != nil {
log.Error("can't close rpc store", zap.Error(err))
}
}
}
}()

return nil
}

Expand Down
1 change: 0 additions & 1 deletion metrics/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ func (c *client) startSendingBatchMessages() {
msgs := b.WaitMinMax(10, 100)
// if batcher is closed
if len(msgs) == 0 {
c.sendNextBatch(nil, b.GetAll())
close(c.closeChannel)
return
}
Expand Down

0 comments on commit 3752072

Please sign in to comment.