From 688be41a834d33013a22bd183ab1551cbde60732 Mon Sep 17 00:00:00 2001 From: Jeff Ortel Date: Fri, 20 Nov 2020 13:54:56 -0600 Subject: [PATCH] Disable the journal when DB closed; add DB.EndWatch(). --- pkg/inventory/model/client.go | 9 +++++++++ 1 file changed, 9 insertions(+) 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 {