mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Implement graceful shutdown of agent.DataAccess (#1008)
* Implements graceful shutdown of agent.DataAccess and underlying Datastore/Logstore/MessageQueue * adds tests for closing agent.DataAccess and Datastore
This commit is contained in:
@@ -84,6 +84,7 @@ type Agent interface {
|
||||
Submit(Call) error
|
||||
|
||||
// Close will wait for any outstanding calls to complete and then exit.
|
||||
// Closing the agent will invoke Close on the underlying DataAccess.
|
||||
// Close is not safe to be called from multiple threads.
|
||||
io.Closer
|
||||
|
||||
@@ -209,6 +210,12 @@ func (a *agent) Close() error {
|
||||
}
|
||||
})
|
||||
|
||||
// shutdown any db/queue resources
|
||||
// associated with DataAccess
|
||||
daErr := a.da.Close()
|
||||
if daErr != nil {
|
||||
return daErr
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user