diff --git a/pkg/inventory/model/client.go b/pkg/inventory/model/client.go index 9ab563ca..6afaf089 100644 --- a/pkg/inventory/model/client.go +++ b/pkg/inventory/model/client.go @@ -35,6 +35,8 @@ type DB interface { Delete(Model) error // Watch a model collection. Watch(Model, EventHandler) (*Watch, error) + // End a watch. + EndWatch(watch *Watch) // The journal Journal() *Journal } @@ -97,6 +99,7 @@ func (r *Client) Close(purge bool) error { if r.db == nil { return nil } + r.journal.Disable() err := r.db.Close() if err != nil { return liberr.Wrap(err) @@ -248,6 +251,12 @@ func (r *Client) Watch(model Model, handler EventHandler) (*Watch, error) { return watch, nil } +// +// End watch. +func (r *Client) EndWatch(watch *Watch) { + r.journal.End(watch) +} + // // The associated journal. func (r *Client) Journal() *Journal {