invoiceninja / dockerfiles

Docker files for Invoice Ninja
https://hub.docker.com/r/invoiceninja/invoiceninja
GNU General Public License v2.0
399 stars 263 forks source link

Counter reset cronjob (systemd) not working in docker image #486

Closed Ninos closed 1 year ago

Ninos commented 1 year ago

I'm using invoiceninja v5 (latest), seems that counter reset cronjob is not working on-the-fly in docker container.

Which command do I need to trigger, to enforce counter resetting? I tried php artisan schedule:work and php artisan queue:work --sleep=3 --tries=1 --memory=256 --timeout=3600, but seems they are just checking for new queues, but I never get a reset counter queue.

Kindest regards

turbo124 commented 1 year ago

@Ninos

Are you referring to the invoice number counter reset? if so, this isn't managed by the crons, we check this every time a number is generated.

Ninos commented 1 year ago

Yes, thx for clarifiing, I mean for example the invoice/offer/client/... number. So seems something ist not working there. Can you may show me the relevant line of code, so I can start debugging in easier way?

turbo124 commented 1 year ago

@Ninos

In the companies table, in the settings column is a json object, let us know the value of these properties


    public $reset_counter_frequency_id = '0'; //@implemented

    public $reset_counter_date = ''; //@implemented
Ninos commented 1 year ago

Sorry for late response. I get following values:

   "reset_counter_frequency_id":"1",
   "reset_counter_date":"2023-01-18",

reset_counter_date was set manually in frontend settings (read something in other topic, changing the date manually can fix the problem).

PS: I have a bit crazy schema, looks something like this: PREFIX-{$date:Ymd}-{$counter}*

But don't think this could lead to any problems?

*PREFIX can be one or more uppercase letters, are manually defined for each type & unique

turbo124 commented 1 year ago

@Ninos

I'm not sure, I cannot recreate this problem. The counter reset date is checked every time a new counter is generated, so it would not depend on any system services.

Ninos commented 1 year ago

@turbo124 can you show me the line of code, which is run to reset the counter? I'll debug it directly in code, may I'll find the "bug" & can create a MR :)

turbo124 commented 1 year ago

https://github.com/invoiceninja/invoiceninja/blob/f9f78579837fd0175bb7a93a841d168fee726b1e/app/Utils/Traits/GeneratesCounter.php#L516

Ninos commented 1 year ago

@turbo124 thx, created a MR with some enhancements. But seems the reset counter function is not triggered while creating new client... :/

PS: We can move the discussion to the MR