Ocean/Log/DeviceDatabase/Flush.go

17 lines
363 B
Go
Raw Permalink Normal View History

package DeviceDatabase
2015-06-17 15:44:52 +00:00
// Flush the cache and write all messages to the database.
func (dev Database) Flush() {
mutexCacheFull.Lock()
defer mutexCacheFull.Unlock()
amount := len(cache)
for counter := 0; counter < amount; counter++ {
write2Database(<-cache)
}
2015-06-17 15:44:52 +00:00
// Shutdown the database connection:
logDB.Logout()
logDBSession.Close()
}