Closed yanickrecher closed 2 years ago
This is a known limitation of the way entry Post Dates are currently “applied” – nothing actually changes at the moment the Post Date is reached; database queries will simply start to include results that they wouldn’t have a minute ago.
See #9170 for a related discussion on how we’re going to fix this in the future. In the meantime, this module provides an event that gets triggered when an entry’s Post Date is reached.
This problem affects headless sites heavily (which coincidentally affects about 20 of our client sites)
Because the GraphQL cache isn't invalidated when a scheduled post should appear, the post in question will never show up until something else in the CMS changes.
Alternatively, if the site is headless only via the config, perhaps this option simply shouldn't appear.
For static sites, a triggered event would also help, as part of our sites is also full static, and we need to trigger a rebuild for these when a schedules item should go live. But this also affects any headless site that is not static.
@FreekVR Alternatively for headless, you could fetch all entries including future ones, and handle the showing and hiding of entries based on their Post/Expiry dates within the front-end application. And if you don’t like that idea, that module approach I linked to previously is still an option.
Unfortunately that is not yet working for Craft 4, but we'll look into forking that and porting it over. It does still feel a bit off to need a workaround until Craft 5 comes out, especially since both gql / headless and scheduled posts are first class features in Craft (and disabling gql cache is not an option for us).
On Mon, 23 Oct 2023, 20:38 Brandon Kelly, @.***> wrote:
@FreekVR https://github.com/FreekVR Alternatively for headless, you could fetch all entries including future ones, and handle the showing and hiding of entries based on their Post/Expiry dates within the front-end application. And if you don’t like that idea, that module approach I linked to previously is still an option.
— Reply to this email directly, view it on GitHub https://github.com/craftcms/cms/issues/11743#issuecomment-1775791988, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADF5CC3PH3HQBUZJ5EIT5LYA22RLAVCNFSM55SOKQSKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZXGU3TSMJZHA4A . You are receiving this because you were mentioned.Message ID: @.***>
I get that it would be great if Craft could just handle it out of the box, but that doesn’t really make sense when you consider half the work is infrastructure (you have to set up a Cron job or similar, to ping Craft every minute), so it’s not something Craft could do completely out of the box.
I can understand that reasoning, but something akin to Laravels schedule/run command could work fine and for most hosting solutions would only require a couple of minutes to set up with a frequent schedule.
This could even include something like the garbage collection which currently has a seperate command which should be implemented (when not using the default implementation running on http requests)
On Mon, 23 Oct 2023, 21:12 Brandon Kelly, @.***> wrote:
I get that it would be great if Craft could just handle it out of the box, but that doesn’t really make sense when you consider half the work is infrastructure (you have to set up a Cron job or similar, to ping Craft every minute), so it’s not something Craft could do completely out of the box.
— Reply to this email directly, view it on GitHub https://github.com/craftcms/cms/issues/11743#issuecomment-1775862630, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADF5CACEIPZPPV54XQJXJTYA26RNAVCNFSM55SOKQSKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZXGU4DMMRWGMYA . You are receiving this because you were mentioned.Message ID: @.***>
I also had a thought it would maybe be possible to dispatch a scheduled job that runs at the specific time an entry will be published according to the scheduled date? Don't know if such a thing is currently possible, but that would work around the problem with having to run some cronjob.
Op ma 23 okt 2023 om 21:31 schreef Freek van Rijt @.***>:
I can understand that reasoning, but something akin to Laravels schedule/run command could work fine and for most hosting solutions would only require a couple of minutes to set up with a frequent schedule.
This could even include something like the garbage collection which currently has a seperate command which should be implemented (when not using the default implementation running on http requests)
On Mon, 23 Oct 2023, 21:12 Brandon Kelly, @.***> wrote:
I get that it would be great if Craft could just handle it out of the box, but that doesn’t really make sense when you consider half the work is infrastructure (you have to set up a Cron job or similar, to ping Craft every minute), so it’s not something Craft could do completely out of the box.
— Reply to this email directly, view it on GitHub https://github.com/craftcms/cms/issues/11743#issuecomment-1775862630, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADF5CACEIPZPPV54XQJXJTYA26RNAVCNFSM55SOKQSKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZXGU4DMMRWGMYA . You are receiving this because you were mentioned.Message ID: @.***>
Yep, we’re looking into using EventBridge for that, with Craft Cloud. If it works we can look into making it a supported feature for other infrastructures as well.
What happened?
Description
Cache is not cleared when scheduled entry gets active (green)
Steps to reproduce
Expected behavior
if a scheduled entry gets active, the cache schould be cleared properly
Actual behavior
cache is not thrown after a scheduled entry gets active.
Craft CMS version
3.7.43
PHP version
8.1
Operating system and version
No response
Database type and version
mysql
Image driver and version
imagick
Installed plugins and versions
Architect 2.4.3 Contact Form 2.5.1 Contact Form Extensions 1.3.1 Contact Form Honeypot 1.0.3 Control Panel CSS 2.4.0 Element API 2.8.5 Google Tag Manager 1.1.0 HTTP2 Server Push 1.0.1 Neo 2.13.10 Project Extension 1.0.0 Read Only 1.0.4 Redactor 2.10.8 SEO 3.7.4 Super Table 2.7.2