@@ -404,8 +404,6 @@ def _apply_object(
404404 if not self .purge_feast_metadata :
405405 self ._set_last_updated_metadata (update_datetime , project )
406406
407- self .refresh ()
408-
409407 def apply_permission (
410408 self , permission : Permission , project : str , commit : bool = True
411409 ):
@@ -494,7 +492,6 @@ def _delete_object(
494492 raise not_found_exception (name , project )
495493 self ._set_last_updated_metadata (_utc_now (), project )
496494
497- self .refresh ()
498495 return cursor .rowcount
499496
500497 def delete_permission (self , name : str , project : str , commit : bool = True ):
@@ -1128,6 +1125,18 @@ def process_project(project: Project):
11281125 project_name = project .name
11291126 last_updated_timestamp = project .last_updated_timestamp
11301127
1128+ try :
1129+ cached_project = self .get_project (project_name , True )
1130+ except ProjectObjectNotFoundException :
1131+ cached_project = None
1132+
1133+ allow_cache = False
1134+
1135+ if cached_project is not None :
1136+ allow_cache = (
1137+ last_updated_timestamp <= cached_project .last_updated_timestamp
1138+ )
1139+
11311140 r .projects .extend ([project .to_proto ()])
11321141 last_updated_timestamps .append (last_updated_timestamp )
11331142
@@ -1142,7 +1151,7 @@ def process_project(project: Project):
11421151 (self .list_validation_references , r .validation_references ),
11431152 (self .list_permissions , r .permissions ),
11441153 ]:
1145- objs : List [Any ] = lister (project_name , allow_cache = False ) # type: ignore
1154+ objs : List [Any ] = lister (project_name , allow_cache ) # type: ignore
11461155 if objs :
11471156 obj_protos = [obj .to_proto () for obj in objs ]
11481157 for obj_proto in obj_protos :
0 commit comments