Skip to content

Commit

Permalink
fix: use client.wait_for_start()
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Oct 17, 2024
1 parent 9591ba0 commit c80aa5a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions aw_watcher_window/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def kill_process(pid):
except ProcessLookupError:
logger.info("Process {} already dead".format(pid))


def try_compile_title_regex(title):
try:
return re.compile(title, re.IGNORECASE)
Expand Down Expand Up @@ -68,8 +69,8 @@ def main():
client.create_bucket(bucket_id, event_type, queued=True)

logger.info("aw-watcher-window started")
client.wait_for_start()

sleep(1) # wait for server to start
with client:
if sys.platform == "darwin" and args.strategy == "swift":
logger.info("Using swift strategy, calling out to swift binary")
Expand Down Expand Up @@ -100,11 +101,17 @@ def main():
poll_time=args.poll_time,
strategy=args.strategy,
exclude_title=args.exclude_title,
exclude_titles=[try_compile_title_regex(title) for title in args.exclude_titles if title is not None]
exclude_titles=[
try_compile_title_regex(title)
for title in args.exclude_titles
if title is not None
],
)


def heartbeat_loop(client, bucket_id, poll_time, strategy, exclude_title=False, exclude_titles=[]):
def heartbeat_loop(
client, bucket_id, poll_time, strategy, exclude_title=False, exclude_titles=[]
):
while True:
if os.getppid() == 1:
logger.info("window-watcher stopped because parent process died")
Expand Down

0 comments on commit c80aa5a

Please sign in to comment.