mitydigital / statamic-scheduled-cache-invalidator

MIT License
2 stars 3 forks source link

Not invalidating due to unequal time comparison #6

Closed dally-dally closed 5 months ago

dally-dally commented 5 months ago

Bug description

Timed entries does not get displayed after the configured time get past.

How to reproduce

When running the scheduler locally with php artisan schedule:work I pointed out, that its exeuted about 1-3 seconds after the minute began. Print something with logger to logfiles e.g.

logger($values['now']->format('H:i:s'));

at src/Scopes/Now.php

Logs

[2024-04-17 10:40:01] local.DEBUG: 10:40:01

When setting a datetime on an entry its 10:40:00 (without seconds enabled in fieldset).

Environment

[...]
Stache Watcher: Enabled
Static Caching: half
Version: 4.53.2 PRO

--

Plugin Version: v2.0.1

PHP: v8.3.0 DDEV: v1.22.6


When seconds are disabled - like here, would it make more sense to ignore the seconds in the Now scope query?

martyf commented 5 months ago

Can I get you to run a test with dev-main and let me know how you go please?

I've changed logic to basically ignore seconds in a weird kinda way, with tests on blueprints that have seconds both enabled and disabled. The test suite passes but just would love additional input to make sure I have cases covered by the new test.

dally-dally commented 5 months ago

Unfortunately when seconds are enabled, it works unreliable. I've tested many dates, in the most cases it's not working, until seconds are lower or equal 8, which was kinda weird.

Disabling seconds works pretty well, and is sufficient for my case!

martyf commented 5 months ago

Can you please provide step by step instructions on how to create this issue (including all setup, and what exactly happens to trigger it) or better yet, provide a link to a repo, so that I can play with this locally.

dally-dally commented 5 months ago

It is basically the plugin installed via composer and the src folder replaced with the current main for testing. In Statamic there is nothing special configured, just a dated collection with time and seconds enabled.

Due to that its working in most cases, could you provide a new release so that I could roll out on my staging environment? I will than report again.

martyf commented 5 months ago

If you update your composer.json file to use dev-main it should pick up the main branch, not a specific release. Then you can deploy to staging.

dally-dally commented 5 months ago

It did not work properly. Today I updated the package due to the other issue https://github.com/mitydigital/statamic-scheduled-cache-invalidator/issues/7. I checked and noticed that I have an orderable collection as well. Now it works.

My issue can so be closed.