-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closes #939: Handle image stats through background processing #943
Closes #939: Handle image stats through background processing #943
Conversation
'imagify_count_attachments_as', | ||
'imagify_count_error_attachments_as', | ||
'imagify_count_optimized_attachments_as', | ||
'imagify_count_saving_data_as', | ||
'imagify_calculate_total_size_images_library_as', | ||
'imagify_calculate_average_size_images_per_month_as', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you have the _as
suffix for the actions?
* | ||
* @var string | ||
*/ | ||
protected $stats_option = 'imagify_admin_stats'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking this naming is not very accurate, what do you think about imagify_attachments_stats
or imagify_media_stats
instead?
* | ||
* @return void | ||
*/ | ||
public function imagify_count_attachments(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the imagify_
prefix from the functions you copied since they're in a class now
* @param integer $default default value to return. | ||
* @return mixed | ||
*/ | ||
function imagify_get_admin_stats( string $key, $default = 0 ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In relation to the option name change suggested, might be better to use imagify_get_attachments_stats
or imagify_get_media_stats
As discussed yesterday, @jeawhanlee should this be closed? |
Description
Fixes #939
Fixes issue with time out when collating stats.
Type of change
Detailed scenario
Explained here
Technical description
Documentation
Moves the stats logic from main thread to process in background using Action Scheduler.
New dependencies
N/A
Risks
Displayed stats will not be updated until the next scheduled action in this case 24hr
Mandatory Checklist
Code validation
Code style
Unticked items justification
If some mandatory items are not relevant, explain why in this section.
Additional Checks