Just a little more efficient
Browse files- API/app.py +2 -4
API/app.py
CHANGED
|
@@ -196,17 +196,15 @@ async def process_post(post_id, session, semaphore):
|
|
| 196 |
|
| 197 |
initial_offsets = [1, 5, 5, 10, 10, 10]
|
| 198 |
|
| 199 |
-
|
| 200 |
start = 0
|
| 201 |
for offset in initial_offsets:
|
| 202 |
end = start + offset
|
| 203 |
if end > len(image_urls):
|
| 204 |
end = len(image_urls)
|
| 205 |
-
|
| 206 |
start = end
|
| 207 |
|
| 208 |
-
chunks = initial_chunks[:]
|
| 209 |
-
|
| 210 |
while start < len(image_urls):
|
| 211 |
end = min(start + 10, len(image_urls))
|
| 212 |
chunks.append((start, end))
|
|
|
|
| 196 |
|
| 197 |
initial_offsets = [1, 5, 5, 10, 10, 10]
|
| 198 |
|
| 199 |
+
chunks = []
|
| 200 |
start = 0
|
| 201 |
for offset in initial_offsets:
|
| 202 |
end = start + offset
|
| 203 |
if end > len(image_urls):
|
| 204 |
end = len(image_urls)
|
| 205 |
+
chunks.append((start, end))
|
| 206 |
start = end
|
| 207 |
|
|
|
|
|
|
|
| 208 |
while start < len(image_urls):
|
| 209 |
end = min(start + 10, len(image_urls))
|
| 210 |
chunks.append((start, end))
|