This is something that occurs many times during the implementation, of course, using navigation or Sitemaps, which depend on the published elements (which, in my opinion, is not an ideal situation).
A possible solution for this would be to use an event system to host the page that generates your XML in the low priority publication queue. This will make (somewhat) certain that it will be published only after your usual publishing actions are completed. Now secondly, the event should check whether this page is already in the queue, so it does not add it a second time.
Keep in mind that this does not prevent him from publishing several times a day, but at least he must make sure that he is never in the queue twice. In a fast system with a dedicated multi-threaded publisher, this may well mean that it is still published every hour or so depending on your activity, etc.
Another option is to schedule the publication once a day of this page, using the event system to repeat this process, so that every day at the same time it is published only once. This will reduce the accuracy of your XML as it is updated only once a day, but it will prevent the publication queue from overflowing. Perhaps this is a problem.
source share