Skip to content

Commit 680a9c9

Browse files
committed
add if input file exists then ...
1 parent ce6fab0 commit 680a9c9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/apify/storage_clients/_file_system/_key_value_store_client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@ async def _sanitize_input_json_files(self) -> None:
8383
for alternative_key in alternative_keys:
8484
alternative_input_file = self.path_to_kvs / alternative_key
8585

86-
# Refresh metadata to prevent inconsistencies
87-
with alternative_input_file.open() as f:
88-
input_data = await asyncio.to_thread(lambda: json.load(f))
89-
await self.set_value(key=configuration.canonical_input_key, value=input_data)
86+
# Only process files that actually exist
87+
if alternative_input_file.exists():
88+
# Refresh metadata to prevent inconsistencies
89+
with alternative_input_file.open() as f:
90+
input_data = await asyncio.to_thread(lambda: json.load(f))
91+
await self.set_value(key=configuration.canonical_input_key, value=input_data)
9092

9193
@override
9294
async def get_value(self, *, key: str) -> KeyValueStoreRecord | None:

0 commit comments

Comments
 (0)