extensions icon indicating copy to clipboard operation
extensions copied to clipboard

Distributed Counter works not according to the settings

Open Monabr opened this issue 4 years ago • 6 comments

Describe your configuration

  • Extension name: firestore-counter
  • Extension version: 0.2.2
  • Configuration values (redact info where appropriate):
    • Document path for internal state: firebase_ext/sharded_counter
    • Frequency for controllerCore function to be run (in minutes): 1440

Describe the problem

So the problem is that it's start working for every new shard and works the period of time even if new doesn't come. This lead functions work 24/7 and increase the price of using it. Also it ignores Frequency that i set and just works whenever new write comes

Steps to reproduce:

Just install the extensions

Expected result

Works only at 1440minutes timer

Actual result

Works every shard written

Monabr avatar May 16 '21 11:05 Monabr

I solved my problem by delete onWrite trigger function. But this is backdoor solution i think

Monabr avatar May 16 '21 12:05 Monabr

Update: problem now solved, now worker works always here is logs

3:04:20.446 PM ext-firestore-counter-worker Function execution started
3:05:05.694 PM ext-firestore-counter-worker Function execution took 45249 ms, finished with status: 'ok'
3:05:06.545 PM ext-firestore-counter-worker Function execution started
3:05:51.662 PM ext-firestore-counter-worker Function execution took 45118 ms, finished with status: 'ok'
3:05:52.247 PM ext-firestore-counter-worker Function execution started
3:06:37.441 PM ext-firestore-counter-worker Function execution took 45195 ms, finished with status: 'ok'
3:06:37.909 PM ext-firestore-counter-worker Function execution started
3:07:23.120 PM ext-firestore-counter-worker Function execution took 45211 ms, finished with status: 'ok'
3:07:23.556 PM ext-firestore-counter-worker Function execution started
3:08:08.762 PM ext-firestore-counter-worker Function execution took 45207 ms, finished with status: 'ok'
3:08:09.146 PM ext-firestore-counter-worker Function execution started 

Monabr avatar May 17 '21 13:05 Monabr

@firebase/invertase @kevinthecheung this seems like a good opportunity to update the firestore-counter preinstall with more info about how billing works (and what the different functions do)

jhuleatt avatar May 17 '21 15:05 jhuleatt

I assume there are 2 logic behind this: work only at intervals and work 24/7. Maybe the solution would be to add a switch from one logic to another so that it will be possible to satisfy the needs of both those who need to collect values once a period, and those who need a live update of the values as soon as they appear.

Monabr avatar May 17 '21 15:05 Monabr

Let's see if this is WAI or is this a bug, and then decide what the best action is

i14h avatar Jul 13 '21 16:07 i14h

Hi @Monabr

We have recently merged some changes to improve the Firestore counter https://github.com/firebase/extensions/pull/817/files.

The latest version is 0.2.5 https://firebase.google.com/products/extensions/firebase-firestore-counter.

Do you still have the issues on the latest version?

dackers86 avatar Jun 06 '22 09:06 dackers86

Closing following updates. Happy to re-open if instructions can be updated or additional bug issues have been found.

dackers86 avatar Feb 10 '23 09:02 dackers86