Skip to content

Commit

Permalink
Properly track last_update
Browse files Browse the repository at this point in the history
  • Loading branch information
FasterSpeeding committed Mar 9, 2024
1 parent fe7298d commit 4e6fecc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ def _poll(
api_url: str,
params: typing.Dict[str, str],
last_update: str,
) -> None:
) -> str:
params = {**params, "since": last_update}

with requests.get(api_url, params=params) as resp:
resp.raise_for_status()
data = resp.json()
logging.info("GITHUB: %s %s", resp.status_code, resp.reason)

tracker_path.write_text(_now())
last_update = _now()
tracker_path.write_text(last_update)

if len(data) > 0:
# new commits.
Expand Down Expand Up @@ -92,6 +93,8 @@ def _poll(
else:
logging.info("No new commits, going to sleep")

return last_update


@click.command()
@click.argument("webhook_url", envvar="DAPI_TRACKER_WEBHOOK_URL")
Expand Down

0 comments on commit 4e6fecc

Please sign in to comment.