mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
fix: [pystemon] pystemon encoding
This commit is contained in:
parent
ead4dba0d8
commit
b575efcc46
1 changed files with 6 additions and 5 deletions
|
@ -54,21 +54,22 @@ r = redis.StrictRedis(host='localhost', db=10, decode_responses=True)
|
|||
|
||||
# 101 pastes processed feed
|
||||
# 102 raw pastes feed
|
||||
topic = '102'
|
||||
|
||||
while True:
|
||||
time.sleep(base_sleeptime + sleep_inc)
|
||||
topic = 101
|
||||
paste = r.lpop("pastes")
|
||||
print(paste)
|
||||
if paste is None:
|
||||
continue
|
||||
socket.send_string("%d %s" % (topic, paste))
|
||||
topic = 102
|
||||
try:
|
||||
with open(pystemonpath+paste, 'rb') as f: #.read()
|
||||
messagedata = f.read()
|
||||
socket.send_string("%d %s %s" % (topic, paste, base64.b64encode(messagedata).decode()))
|
||||
sleep_inc = sleep_inc-0.01 if sleep_inc-0.01 > 0 else 0
|
||||
path_to_send = pystemonpath+paste
|
||||
|
||||
s = b' '.join( [ topic.encode(), path_to_send.encode(), base64.b64encode(messagedata) ] )
|
||||
socket.send(s)
|
||||
sleep_inc = sleep_inc-0.01 if sleep_inc-0.01 > 0 else 0
|
||||
except IOError as e:
|
||||
# file not found, could be a buffering issue -> increase sleeping time
|
||||
print('IOError: Increasing sleep time')
|
||||
|
|
Loading…
Reference in a new issue