mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
fix: SweepingProvider slow start (#10980)
Some checks are pending
CodeQL / codeql (push) Waiting to run
Docker Check / lint (push) Waiting to run
Docker Check / build (push) Waiting to run
Gateway Conformance / gateway-conformance (push) Waiting to run
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Waiting to run
Go Build / go-build (push) Waiting to run
Go Check / go-check (push) Waiting to run
Go Lint / go-lint (push) Waiting to run
Go Test / go-test (push) Waiting to run
Interop / interop-prep (push) Waiting to run
Interop / helia-interop (push) Blocked by required conditions
Interop / ipfs-webui (push) Blocked by required conditions
Sharness / sharness-test (push) Waiting to run
Spell Check / spellcheck (push) Waiting to run
Some checks are pending
CodeQL / codeql (push) Waiting to run
Docker Check / lint (push) Waiting to run
Docker Check / build (push) Waiting to run
Gateway Conformance / gateway-conformance (push) Waiting to run
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Waiting to run
Go Build / go-build (push) Waiting to run
Go Check / go-check (push) Waiting to run
Go Lint / go-lint (push) Waiting to run
Go Test / go-test (push) Waiting to run
Interop / interop-prep (push) Waiting to run
Interop / helia-interop (push) Blocked by required conditions
Interop / ipfs-webui (push) Blocked by required conditions
Sharness / sharness-test (push) Waiting to run
Spell Check / spellcheck (push) Waiting to run
* fix: SweepingProvider slow start #10979 * don't purge keystore * feat: add INFO logging for provider keystore sync log start/completion of async keystore sync with strategy --------- Co-authored-by: Marcin Rataj <lidel@lidel.org>
This commit is contained in:
parent
46d438f685
commit
1e9b6fb27e
@ -428,9 +428,18 @@ func SweepingProviderOpt(cfg *config.Config) fx.Option {
|
||||
// replace them with the keys that needs to be reprovided, coming from
|
||||
// the KeyChanFunc. So far, this is the less worse way to remove CIDs
|
||||
// that shouldn't be reprovided from the provider's state.
|
||||
if err := syncKeyStore(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
go func() {
|
||||
// Sync the keystore once at startup. This operation is async since
|
||||
// we need to walk the DAG of objects matching the provide strategy,
|
||||
// which can take a while.
|
||||
strategy := cfg.Provide.Strategy.WithDefault(config.DefaultProvideStrategy)
|
||||
logger.Infow("provider keystore sync started", "strategy", strategy)
|
||||
if err := syncKeyStore(ctx); err != nil {
|
||||
logger.Errorw("provider keystore sync failed", "err", err, "strategy", strategy)
|
||||
} else {
|
||||
logger.Infow("provider keystore sync completed", "strategy", strategy)
|
||||
}
|
||||
}()
|
||||
|
||||
gcCtx, c := context.WithCancel(context.Background())
|
||||
cancel = c
|
||||
@ -462,10 +471,10 @@ func SweepingProviderOpt(cfg *config.Config) fx.Option {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
}
|
||||
// KeyStore state isn't be persisted across restarts.
|
||||
if err := in.KeyStore.Empty(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Keystore data isn't purged, on close, but it will be overwritten
|
||||
// when the node starts again.
|
||||
|
||||
return in.KeyStore.Close()
|
||||
},
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user