Fix exception when attempting to write a datetime to db (#5467)
redis-py 3.0 used in master branch only accepts user data as bytes, strings or numbers (ints, longs and floats). Attempting to specify a key or a value as any other type will raise a DataError exception. This PR address the issue bt converting datetime to str
This commit is contained in:
parent
13cec4c486
commit
584e2223dc
@ -184,9 +184,9 @@ class ProcDockerStats(daemon_base.DaemonBase):
|
|||||||
self.update_dockerstats_command()
|
self.update_dockerstats_command()
|
||||||
datetimeobj = datetime.now()
|
datetimeobj = datetime.now()
|
||||||
# Adding key to store latest update time.
|
# Adding key to store latest update time.
|
||||||
self.update_state_db('DOCKER_STATS|LastUpdateTime', 'lastupdate', datetimeobj)
|
self.update_state_db('DOCKER_STATS|LastUpdateTime', 'lastupdate', str(datetimeobj))
|
||||||
self.update_processstats_command()
|
self.update_processstats_command()
|
||||||
self.update_state_db('PROCESS_STATS|LastUpdateTime', 'lastupdate', datetimeobj)
|
self.update_state_db('PROCESS_STATS|LastUpdateTime', 'lastupdate', str(datetimeobj))
|
||||||
|
|
||||||
# Data need to be updated every 2 mins. hence adding delay of 120 seconds
|
# Data need to be updated every 2 mins. hence adding delay of 120 seconds
|
||||||
time.sleep(120)
|
time.sleep(120)
|
||||||
|
Loading…
Reference in New Issue
Block a user