Fix redis GEOADD

Redis python interface only accepts two arguments, the keyname to store in redis and a value-list with the coordinates and content to which the coordinates refer, in groups of three.
pull/161/head
Lucas Magalhães 2021-12-14 23:46:18 +00:00
parent c093363e99
commit 100948b4df
1 changed files with 5 additions and 1 deletions

View File

@ -208,11 +208,15 @@ class Geo_helper:
today_str = util.getDateStrFormat(now)
keyname = "{}:{}".format(keyCateg, today_str)
try:
self.serv_redis_db.geoadd(keyname, lon, lat, content)
self.serv_redis_db.geoadd(keyname, [lon, lat, content])
except redis.exceptions.ResponseError as error:
print(error)
print("Please fix the above, and make sure you use a redis version that supports the GEOADD command.")
print("To test for support: echo \"help GEOADD\"| redis-cli")
except redis.exceptions.DataError as error:
print(error)
print("Please fix the above, and make sure you use a redis version that supports the GEOADD command.")
print("To test for support: echo \"help GEOADD\"| redis-cli")
self.logger.debug('Added to redis: keyname={}, lon={}, lat={}, content={}'.format(keyname, lon, lat, content))
def push_to_redis_zset(self, keyCateg, toAdd, endSubkey="", count=1):