Spaces:
Build error
Build error
chore: suspend data crunching
Browse files
backend/functions/src/cloud-functions/data-crunching.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
| 5 |
} from 'civkit';
|
| 6 |
import { singleton } from 'tsyringe';
|
| 7 |
import {
|
| 8 |
-
CloudScheduleV2, CloudTaskV2,
|
| 9 |
FirebaseStorageBucketControl, Logger, Param, TempFileManager
|
| 10 |
} from '../shared';
|
| 11 |
import _ from 'lodash';
|
|
@@ -48,24 +48,24 @@ export class DataCrunchingHost extends RPCHost {
|
|
| 48 |
this.emit('ready');
|
| 49 |
}
|
| 50 |
|
| 51 |
-
@CloudTaskV2({
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
})
|
| 69 |
async crunchPageCacheWorker(
|
| 70 |
@Param('date') date: string,
|
| 71 |
@Param('offset', { default: 0 }) offset: number
|
|
@@ -87,18 +87,18 @@ export class DataCrunchingHost extends RPCHost {
|
|
| 87 |
return true;
|
| 88 |
}
|
| 89 |
|
| 90 |
-
@CloudScheduleV2('2 0 * * *', {
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
})
|
| 102 |
async dispatchPageCacheCrunching() {
|
| 103 |
for await (const { fileName, date, offset } of this.iterPageCacheChunks()) {
|
| 104 |
this.logger.info(`Dispatching ${fileName}...`);
|
|
|
|
| 5 |
} from 'civkit';
|
| 6 |
import { singleton } from 'tsyringe';
|
| 7 |
import {
|
| 8 |
+
// CloudScheduleV2, CloudTaskV2,
|
| 9 |
FirebaseStorageBucketControl, Logger, Param, TempFileManager
|
| 10 |
} from '../shared';
|
| 11 |
import _ from 'lodash';
|
|
|
|
| 48 |
this.emit('ready');
|
| 49 |
}
|
| 50 |
|
| 51 |
+
// @CloudTaskV2({
|
| 52 |
+
// runtime: {
|
| 53 |
+
// cpu: 2,
|
| 54 |
+
// memory: '4GiB',
|
| 55 |
+
// timeoutSeconds: 3600,
|
| 56 |
+
// concurrency: 2,
|
| 57 |
+
// maxInstances: 200,
|
| 58 |
+
// retryConfig: {
|
| 59 |
+
// maxAttempts: 3,
|
| 60 |
+
// minBackoffSeconds: 60,
|
| 61 |
+
// },
|
| 62 |
+
// rateLimits: {
|
| 63 |
+
// maxConcurrentDispatches: 150,
|
| 64 |
+
// maxDispatchesPerSecond: 2,
|
| 65 |
+
// },
|
| 66 |
+
// },
|
| 67 |
+
// tags: ['DataCrunching'],
|
| 68 |
+
// })
|
| 69 |
async crunchPageCacheWorker(
|
| 70 |
@Param('date') date: string,
|
| 71 |
@Param('offset', { default: 0 }) offset: number
|
|
|
|
| 87 |
return true;
|
| 88 |
}
|
| 89 |
|
| 90 |
+
// @CloudScheduleV2('2 0 * * *', {
|
| 91 |
+
// name: 'crunchPageCacheEveryday',
|
| 92 |
+
// runtime: {
|
| 93 |
+
// cpu: 2,
|
| 94 |
+
// memory: '4GiB',
|
| 95 |
+
// timeoutSeconds: 1800,
|
| 96 |
+
// timeZone: 'UTC',
|
| 97 |
+
// retryCount: 3,
|
| 98 |
+
// minBackoffSeconds: 60,
|
| 99 |
+
// },
|
| 100 |
+
// tags: ['DataCrunching'],
|
| 101 |
+
// })
|
| 102 |
async dispatchPageCacheCrunching() {
|
| 103 |
for await (const { fileName, date, offset } of this.iterPageCacheChunks()) {
|
| 104 |
this.logger.info(`Dispatching ${fileName}...`);
|