Skip to content

FIX: Optimise and update queries, shorter frequency #20

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

Merged
merged 2 commits into from
Mar 26, 2025
Merged

Conversation

nattsw
Copy link
Contributor

@nattsw nattsw commented Mar 26, 2025

This PR solves a few issues:

  • Currently due to the 14.day schedule, any sites with remind_mark_solution_last_post_age of 1 will not be able to receive notifications. This bumps the frequency to a day
  • On a site with hundreds of thousands of topics, this loads all the ids into memory unsolved_topic_ids.push(*Topic.where(category_id: category_ids).pluck(:id)) 😱
  • Many plucks (N+1)
  • (Potentially) Large array subtractions are inefficient and could be done in the database
  • Moves to custom fields as per DEV: Move solved custom fields into a table discourse-solved#342

Copy link

@dbattersby dbattersby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@nattsw nattsw merged commit be146b2 into main Mar 26, 2025
3 checks passed
@nattsw nattsw deleted the job-schedule branch March 26, 2025 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants