diff options
Diffstat (limited to 'src/server/apis/google/GooglePhotosUploadUtils.ts')
| -rw-r--r-- | src/server/apis/google/GooglePhotosUploadUtils.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/apis/google/GooglePhotosUploadUtils.ts b/src/server/apis/google/GooglePhotosUploadUtils.ts index 507a868a3..16c4f6c3a 100644 --- a/src/server/apis/google/GooglePhotosUploadUtils.ts +++ b/src/server/apis/google/GooglePhotosUploadUtils.ts @@ -3,7 +3,7 @@ import { GoogleApiServerUtils } from './GoogleApiServerUtils'; import * as path from 'path'; import { MediaItemCreationResult } from './SharedTypes'; import { NewMediaItem } from "../../index"; -import BatchedArray, { FixedBatcher, TimeUnit, Interval } from "array-batcher"; +import { BatchedArray, TimeUnit } from 'array-batcher'; export namespace GooglePhotosUploadUtils { @@ -53,7 +53,8 @@ export namespace GooglePhotosUploadUtils { }; export const CreateMediaItems = async (newMediaItems: NewMediaItem[], album?: { id: string }): Promise<MediaItemCreationResult> => { - const newMediaItemResults = await BatchedArray.from(newMediaItems, { batchSize: 50 }).batchedMapInterval( + const newMediaItemResults = await BatchedArray.from(newMediaItems, { batchSize: 50 }).batchedMapPatientInterval( + { magnitude: 100, unit: TimeUnit.Milliseconds }, async (batch: NewMediaItem[]) => { const parameters = { method: 'POST', @@ -72,8 +73,7 @@ export namespace GooglePhotosUploadUtils { } }); })).newMediaItemResults; - }, - { magnitude: 100, unit: TimeUnit.Milliseconds } + } ); return { newMediaItemResults }; }; |
