@@ -56,15 +56,17 @@ export const controllerCore = functions.handler.pubsub.topic.onPublish(
56
56
/**
57
57
* Backwards compatible HTTPS function
58
58
*/
59
- export const controller = functions . https . onRequest ( async ( req , res ) => {
60
- if ( ! pubsub ) {
61
- pubsub = new PubSub ( ) ;
59
+ export const controller = functions . handler . https . onRequest (
60
+ async ( req , res ) => {
61
+ if ( ! pubsub ) {
62
+ pubsub = new PubSub ( ) ;
63
+ }
64
+ await pubsub
65
+ . topic ( process . env . EXT_INSTANCE_ID )
66
+ . publish ( Buffer . from ( JSON . stringify ( { } ) ) ) ;
67
+ res . status ( 200 ) . send ( "Ok" ) ;
62
68
}
63
- await pubsub
64
- . topic ( process . env . EXT_INSTANCE_ID )
65
- . publish ( Buffer . from ( JSON . stringify ( { } ) ) ) ;
66
- res . status ( 200 ) . send ( "Ok" ) ;
67
- } ) ;
69
+ ) ;
68
70
69
71
/**
70
72
* Worker is responsible for aggregation of a defined range of shards. It is controlled
@@ -74,10 +76,8 @@ export const controller = functions.https.onRequest(async (req, res) => {
74
76
* ControllerCore is monitoring these metadata documents to detect overload that requires
75
77
* resharding and to detect failed workers that need poking.
76
78
*/
77
- export const worker = functions . firestore
78
- . document (
79
- process . env . INTERNAL_STATE_PATH + WORKERS_COLLECTION_ID + "/{workerId}"
80
- )
79
+ export const worker = functions . handler . firestore
80
+ . document
81
81
. onWrite ( async ( change , context ) => {
82
82
// stop worker if document got deleted
83
83
if ( ! change . after . exists ) return ;
@@ -91,8 +91,8 @@ export const worker = functions.firestore
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 . firestore
95
- . document ( "/{collection}/{**}/_counter_shards_/{shardId}" )
94
+ export const onWrite = functions . handler . firestore
95
+ . document
96
96
. onWrite ( async ( change , context ) => {
97
97
const metadocRef = firestore . doc ( process . env . INTERNAL_STATE_PATH ) ;
98
98
const controller = new ShardedCounterController (
0 commit comments