Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix caching objects in pygithub, and changelogs #55845

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/ci/github_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def get_release_pulls(self, repo_name: str) -> PullRequests:
label="release",
)

def sleep_on_rate_limit(self):
def sleep_on_rate_limit(self) -> None:
for limit, data in self.get_rate_limit().raw_data.items():
if data["remaining"] == 0:
sleep_time = data["reset"] - int(datetime.now().timestamp()) + 1
Expand Down Expand Up @@ -199,13 +199,13 @@ def _is_cache_updated(
# We don't want the cache_updated being always old,
# for example in cases when the user is not updated for ages
cache_updated = max(
datetime.fromtimestamp(cache_file.stat().st_mtime), cached_obj.updated_at
cache_file.stat().st_mtime, cached_obj.updated_at.timestamp()
)
if obj_updated_at is None:
# When we don't know about the object is updated or not,
# we update it once per hour
obj_updated_at = datetime.now() - timedelta(hours=1)
if obj_updated_at <= cache_updated:
if obj_updated_at.timestamp() <= cache_updated:
return True, cached_obj
return False, cached_obj

Expand Down