Scheduling notification

I was looking through the built in Notifications hoping to find one pertaining to the act of scheduling an entry. Not the notification for when it is later published but right when someone saves a new publish time.

I can’t find one that seems to be for that purpose. Is there any other notification to use, or some other approach to tie into code execution for when a user has set up scheduling?

Use case being wanting to adjust content based on the time selected for scheduling.

As far as I know, there is no notification for that sadly. But I’m just wondering about your use case, maybe we can come up with a different approach depending on what you want to do.

The idea was to catch a given time an editor requests a schedule to happen at.

Then schedule it automatically 5 minutes earlier and save the requested time in a separate field, and only allow render of the page right when that time has passed.

It is my preferred solution for this issue:

Ah yes, I remember that topic.

There is no notification for scheduling a publish, I just checked the source code 13. I see two options:

  • Check the scheduled on save. Scheduling a publish triggers the save event and you can check if the node has a schedule act on that. The disadvantage is that this will be executes on every single save, so I think performance wise it’s not really great.
  • A background job that checks the scheduled publishes on a regular interval and act on that. I assume that most things are scheduled well in advance, so a background job that executes once on a while is probably good enough.

Just some thoughts!

Thanks, some good ideas.

If we check on save, does that “catch” a schedule that happens after you have “finished” your content?

Like, work on content, trigger 10 x save notifications, and then AFTER that you schedule it. In that case you wont get a save notification, I guess?

My AI agent says that this is the flow when you schedule publish:

When you set a schedule in the backoffice, the flow is:

  1. ContentService.Save(content, userId, contentSchedule) or ContentService.PersistContentSchedule(content, contentSchedule)
  2. ContentSavingNotification fires :white_check_mark:
  3. The content is saved
  4. ContentSavedNotification fires :white_check_mark:
  5. The schedule is persisted to the database

So there could really be a timing issue here. So I think a background job would absolutely be the better way to go.

1 Like