Enforced cast to string for any object posted to the Redis bus

This commit is contained in:
Fabio Manganiello 2018-11-20 14:24:14 +00:00
parent c2be1cf6e8
commit 6603f64757
3 changed files with 5 additions and 3 deletions

View File

@ -149,7 +149,7 @@ class HttpBackend(Backend):
redis = self._get_redis()
if redis:
redis.rpush(self.redis_queue, stop_evt)
redis.rpush(self.redis_queue, str(stop_evt))
if self.server_proc:
self.server_proc.terminate()
@ -284,7 +284,7 @@ class HttpBackend(Backend):
redis = self._get_redis()
if redis:
redis.rpush(self.redis_queue, event)
redis.rpush(self.redis_queue, str(event))
return jsonify({ 'status': 'ok' })
@app.route('/static/<path>', methods=['GET'])

View File

@ -35,6 +35,7 @@ class RedisBackend(Backend):
def send_message(self, msg, queue_name=None):
msg = str(msg)
if queue_name:
self.redis.rpush(queue_name, msg)
else:

View File

@ -1,5 +1,6 @@
import ast
import statistics
import json
import time
from threading import Thread, Lock
@ -141,7 +142,7 @@ class AdafruitIoPlugin(Plugin):
else:
# Otherwise send it to the Redis queue to be picked up by the throttler thread
redis = self._get_redis()
redis.rpush(self._DATA_THROTTLER_QUEUE, {feed:value})
redis.rpush(self._DATA_THROTTLER_QUEUE, json.dumps({feed:value}))
@action