Shutdown command queue #233
Labels
No labels
bug
confirmed
critical
discussion
documentation
Doing
enhancement
experiment
suggestion
support
Testing
To Do
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: hazaar/framework#233
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'm starting to try and do more things in the
__destruct()
function to make things speedy. Thing is, if the object goes out of scope before the buffer gets spat at the browser, it's not going to make much difference.What I need to do is have a shutdown command queue. That is, these things that want to do things on destruct so they don't impact load times, can register the command in the queue then once the app shuts down and flushes the buffer, these things will execute. That way they should be able to take as long as they want without actually affecting the user experience.
changed the description
Turns out, this is already built into PHP. See: https://www.php.net/manual/en/function.register-shutdown-function.php. So I will use this issue/branch to update some things in Hazaar that are currently executing in destructors that should probably be executed using this method.
I am now creating
register_shutdown_task()
which is similar to the PHP function, except it takes an optional unique ID so that tasks can be performed only once. This is handy for things likeHazaar\Cache
which can do a cleanup on files or a database or something but we MAY have multiple cache instances but we only want to cleanup once.mentioned in merge request !150
mentioned in commit 6b825233c92948fda32ff28bd360243ac72d42a5