0

Cleanup the persisted disconnected time

This commit is contained in:
Gabe Kangas 2021-06-29 10:04:26 -07:00
parent 516e4e89c0
commit ab3bbd59bf

View File

@ -328,14 +328,20 @@ func SetPeakOverallViewerCount(count int) error {
// GetLastDisconnectTime will return the time the last stream ended. // GetLastDisconnectTime will return the time the last stream ended.
func GetLastDisconnectTime() (utils.NullTime, error) { func GetLastDisconnectTime() (utils.NullTime, error) {
var disconnectTime = utils.NullTime{time.Now(), false} invalidTime := utils.NullTime{Time: time.Now(), Valid: false}
var disconnectTime utils.NullTime
configEntry, err := _datastore.Get(lastDisconnectTimeKey) configEntry, err := _datastore.Get(lastDisconnectTimeKey)
if err != nil { if err != nil {
return disconnectTime, err return invalidTime, err
} }
if err := configEntry.getObject(&disconnectTime); err != nil { if err := configEntry.getObject(&disconnectTime); err != nil {
return disconnectTime, err return invalidTime, err
}
if !disconnectTime.Valid {
return invalidTime, err
} }
return disconnectTime, nil return disconnectTime, nil