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

Use datetime.utcnow() to avoid timezone issues #2265

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sdk/python/feast/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def apply_feature_view(
"""
feature_view.ensure_valid()
if not feature_view.created_timestamp:
feature_view.created_timestamp = datetime.now()
feature_view.created_timestamp = datetime.utcnow()
feature_view_proto = feature_view.to_proto()
feature_view_proto.spec.project = project
self._prepare_registry_for_changes()
Expand Down Expand Up @@ -819,7 +819,7 @@ def _prepare_registry_for_changes(self):
registry_proto = RegistryProto()
registry_proto.registry_schema_version = REGISTRY_SCHEMA_VERSION
self.cached_registry_proto = registry_proto
self.cached_registry_proto_created = datetime.now()
self.cached_registry_proto_created = datetime.utcnow()
return self.cached_registry_proto

def _get_registry_proto(self, allow_cache: bool = False) -> RegistryProto:
Expand All @@ -838,7 +838,7 @@ def _get_registry_proto(self, allow_cache: bool = False) -> RegistryProto:
self.cached_registry_proto_ttl.total_seconds()
> 0 # 0 ttl means infinity
and (
datetime.now()
datetime.utcnow()
> (
self.cached_registry_proto_created
+ self.cached_registry_proto_ttl
Expand All @@ -852,7 +852,7 @@ def _get_registry_proto(self, allow_cache: bool = False) -> RegistryProto:

registry_proto = self._registry_store.get_registry_proto()
self.cached_registry_proto = registry_proto
self.cached_registry_proto_created = datetime.now()
self.cached_registry_proto_created = datetime.utcnow()

return registry_proto

Expand Down