Skip to content

Conversation

@Soare-Robert-Daniel
Copy link
Contributor

@Soare-Robert-Daniel Soare-Robert-Daniel commented May 30, 2024

Summary

  • Use 10 minutes cron instead of hourly
  • Small refactor on the schedules update

Will affect visual aspect of the product

NO

Screenshots

image

Test instructions

  • Check the Cron and see if its 10 minutes

Check before Pull Request is ready:

Closes https://github.com/Codeinwp/visualizer-pro/issues/474

@Soare-Robert-Daniel Soare-Robert-Daniel added the pr-checklist-skip Allow this Pull Request to skip checklist. label May 30, 2024
@Soare-Robert-Daniel Soare-Robert-Daniel self-assigned this May 30, 2024
@Soare-Robert-Daniel Soare-Robert-Daniel marked this pull request as ready for review May 31, 2024 10:15
@pirate-bot
Copy link
Contributor

Plugin build for 4184b7e is ready 🛎️!

@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label May 31, 2024
@rodica-andronache
Copy link
Contributor

@Soare-Robert-Daniel tested and it's working well 👍

@Soare-Robert-Daniel Soare-Robert-Daniel merged commit 588bf4a into development Jun 5, 2024
@Soare-Robert-Daniel Soare-Robert-Daniel deleted the fix/10-minutes-schedule branch June 5, 2024 14:18
@Soare-Robert-Daniel Soare-Robert-Daniel mentioned this pull request Jun 5, 2024
@vytisbulkevicius
Copy link
Contributor

vytisbulkevicius commented Jul 3, 2024

@Soare-Robert-Daniel,

I tested this with the final merge and it doesn't work to me. Charts are getting refreshed only after one hour not each ten minutes.

I see that the code change added here: https://github.com/Codeinwp/visualizer/pull/1161/files#diff-6a2bceb3434041451d4f3359e058407647985c3f74f400623aeafe9675cd0b92R213

Change the Recurrence of visualizer_schedule_refresh_db to 10 minutes, however, there is also visualizer_schedule_import hook that remains 1 hour and because of it the chart doesn't get refresh.

I changed the code in my test instance to:

wp_clear_scheduled_hook( 'visualizer_schedule_refresh_db' );
wp_clear_scheduled_hook( 'visualizer_schedule_import' );
wp_schedule_event( strtotime( 'midnight' ) - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS, apply_filters( 'visualizer_chart_schedule_interval', 'visualizer_ten_minutes' ), 'visualizer_schedule_refresh_db' );
wp_schedule_event( strtotime( 'midnight' ) - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS, apply_filters( 'visualizer_chart_schedule_interval', 'visualizer_ten_minutes' ), 'visualizer_schedule_import' );

So added same for visualizer_schedule_import as you did for visualizer_schedule_refresh_db and then it worked - charts got refreshed after 10 minutes.

Can you fix this?

Thanks!

@Soare-Robert-Daniel
Copy link
Contributor Author

As an idea, 'visualizer_schedule_refresh_db' indirectly call 'visualizer_schedule_import'.

The route is like this:

Technically, the second schedule is not needed unless the first schedule is missing a chart type to update that the second might not.

What type of source (along with the URL) did you use?

@vytisbulkevicius
Copy link
Contributor

@Soare-Robert-Daniel, I used both the CSV and Database and it wasn't refresh in any of them, I think you can easily replicate it yourself as well. Let me know if it works for you

@vytisbulkevicius
Copy link
Contributor

Hi @Soare-Robert-Daniel,

Any update here?

@Soare-Robert-Daniel
Copy link
Contributor Author

@vytisbulkevicius, here is the PR https://github.com/Codeinwp/visualizer-pro/pull/481

I also created this issue https://github.com/Codeinwp/visualizer-pro/issues/482

Sorry for the issue. My attention and understanding are not in the best shape 😞, I misinterpreted the process.

@pirate-bot
Copy link
Contributor

🎉 This PR is included in version 3.11.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label) pr-checklist-skip Allow this Pull Request to skip checklist. released Indicate that an issue has been resolved and released in a particular version of the product.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants