Skip to content

Commit

Permalink
Use datetime.utcnow() to avoid timezone issues
Browse files Browse the repository at this point in the history
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
  • Loading branch information
judahrand committed Feb 2, 2022
1 parent 592af75 commit 2de9394
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 2de9394

Please sign in to comment.