···58 return # There are no currently unexpired files
5960 # Calculate an expiration date for all existing files
61- files = session.scalars(
062 sa.select(File)
63 .where(
64- sa.not_(File.removed),
65- File.sha256.in_(unexpired_files)
66 )
67 )
68 updates = [] # We coalesce updates to the database here
0000069 for file in files:
70 file_path = storage / file.sha256
71 stat = os.stat(file_path)
···58 return # There are no currently unexpired files
5960 # Calculate an expiration date for all existing files
61+62+ q = session.scalars(
63 sa.select(File)
64 .where(
65+ sa.not_(File.removed)
066 )
67 )
68 updates = [] # We coalesce updates to the database here
69+70+ # SQLite has a hard limit on the number of variables so we
71+ # need to do this the slow way
72+ files = [f for f in q if f.sha256 in unexpired_files]
73+74 for file in files:
75 file_path = storage / file.sha256
76 stat = os.stat(file_path)