File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
firestore-counter/functions/src Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -76,28 +76,28 @@ export const controller = functions.handler.https.onRequest(
76
76
* ControllerCore is monitoring these metadata documents to detect overload that requires
77
77
* resharding and to detect failed workers that need poking.
78
78
*/
79
- export const worker = functions . handler . firestore
80
- . document
81
- . onWrite ( async ( change , context ) => {
79
+ export const worker = functions . handler . firestore . document . onWrite (
80
+ async ( change , context ) => {
82
81
// stop worker if document got deleted
83
82
if ( ! change . after . exists ) return ;
84
83
85
84
const worker = new ShardedCounterWorker ( change . after , SHARDS_COLLECTION_ID ) ;
86
85
await worker . run ( ) ;
87
- } ) ;
86
+ }
87
+ ) ;
88
88
89
89
/**
90
90
* This is an additional function that is triggered for every shard write. It is
91
91
* limited to one concurrent run at the time. This helps reduce latency for workloads
92
92
* that are below the threshold for workers.
93
93
*/
94
- export const onWrite = functions . handler . firestore
95
- . document
96
- . onWrite ( async ( change , context ) => {
94
+ export const onWrite = functions . handler . firestore . document . onWrite (
95
+ async ( change , context ) => {
97
96
const metadocRef = firestore . doc ( process . env . INTERNAL_STATE_PATH ) ;
98
97
const controller = new ShardedCounterController (
99
98
metadocRef ,
100
99
SHARDS_COLLECTION_ID
101
100
) ;
102
101
await controller . aggregateContinuously ( { start : "" , end : "" } , 200 , 60000 ) ;
103
- } ) ;
102
+ }
103
+ ) ;
You can’t perform that action at this time.
0 commit comments