Commit e4d9bd1e authored by nimrod's avatar nimrod
Browse files

Notifcation retries.

parent 21ff987e
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -16,11 +16,16 @@ HOSTNAME = socket.gethostname()

def notify(message):
    """Send a notification."""
    for _ in range(3):
        r = requests.post(  # pylint: disable=invalid-name
            "https://notify.shore.co.il/send", params={"message": message}
        )
    if not r.ok:
        logging.error(f"Failed to send notification: {r.reason}.")
        if r.ok:
            return
        logging.warning(
            f"Failed to send notification: {r.reason}, will retry."
        )
        logging.error("Failed to send notification.")


def main():  # noqa: MC0001