This commit is contained in:
parent
c6b444bc6d
commit
e6afdd5bac
@ -90,15 +90,18 @@ def on_message_creator(mqtt_: MQTT):
|
|||||||
)
|
)
|
||||||
except requests.exceptions.Timeout:
|
except requests.exceptions.Timeout:
|
||||||
logging.error(f"Input-service timed out! (Timeout: {config.INPUT_TIMEOUT} sec)")
|
logging.error(f"Input-service timed out! (Timeout: {config.INPUT_TIMEOUT} sec)")
|
||||||
return # no ack
|
channel.basic_nack(delivery_tag=method.delivery_tag, requeue=True)
|
||||||
|
return
|
||||||
|
|
||||||
if r.status_code != 200:
|
if r.status_code != 200:
|
||||||
logging.error(f"Input-service status code is not 200: {r.status_code}")
|
logging.error(f"Input-service status code is not 200: {r.status_code}")
|
||||||
return # no ack
|
channel.basic_nack(delivery_tag=method.delivery_tag, requeue=True)
|
||||||
|
return
|
||||||
|
|
||||||
if 'device_id' not in r.json():
|
if 'device_id' not in r.json():
|
||||||
logging.error("Input-service response invalid")
|
logging.error("Input-service response invalid")
|
||||||
return # no ack
|
channel.basic_nack(delivery_tag=method.delivery_tag, requeue=True)
|
||||||
|
return
|
||||||
|
|
||||||
logging.info(f"Sending alert command to device {r.json()['device_id']}...")
|
logging.info(f"Sending alert command to device {r.json()['device_id']}...")
|
||||||
mqtt_.publish(
|
mqtt_.publish(
|
||||||
|
Loading…
Reference in New Issue
Block a user