discourse/spec/jobs
David Taylor c0293339b8
PERF: Do not enqueue digest emails when attempted recently (#10849)
Previously, Jobs::EnqueueDigestEmails would enqueue a digest job for every user, even if there are no topics to send. The digest job would exit, no email would send, and last_emailed_at would not change. 30 minutes later, Jobs::EnqueueDigestEmails would run again and re-enqueue jobs for the same users.

120fa8ad introduced a temporary mitigation for this issue, by randomly selecting a subset of those users each time.

This commit adds a new `digest_attempted_at` column to the `user_stats` table. This column is updated every time a digest job completes for a user. Using this, we can avoid scheduling digest jobs for the same user every 30 minutes. This also removes the random user selection in 120fa8ad, and instead prioritizes users who had digests attempted the longest time ago.
2020-10-07 15:30:38 +01:00
..
regular FIX: Change secure media to encompass attachments as well (#9271) 2020-03-26 07:16:02 +10:00
about_stats_spec.rb DEV: s/\$redis/Discourse\.redis (#8431) 2019-12-03 10:05:53 +01:00
activation_reminder_emails_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
auto_expire_user_api_keys_spec.rb DEV: Improve flaky time-sensitive specs (#9141) 2020-03-10 22:13:17 +01:00
auto_queue_handler_spec.rb DEV: Remove stray code that has been commented out. 2020-07-29 09:58:29 +08:00
automatic_group_membership_spec.rb UX: drop the `automatic_membership_retroactive` column from groups model. (#9430) 2020-04-22 22:07:39 +05:30
bookmark_reminder_notifications_spec.rb FIX: dont error when bookmark topic is nil (#10555) 2020-08-31 09:15:36 +10:00
bulk_grant_trust_level_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
bulk_invite_spec.rb FEATURE: allow sending bulk invites to staged users 2019-10-30 11:40:03 +05:30
bump_topic_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
clean_up_associated_accounts_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
clean_up_crawler_stats_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
clean_up_email_logs_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
clean_up_inactive_users_spec.rb FIX: Don’t try to delete inactive moderators 2019-05-13 21:44:03 +02:00
clean_up_post_reply_keys_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
clean_up_unused_staged_users_spec.rb FEATURE: Add site setting to disable staged user cleanup 2020-03-09 10:26:41 +01:00
clean_up_uploads_spec.rb FEATURE: Remove deprecated uploads url site settings. 2020-06-22 14:32:29 +08:00
clean_up_user_export_topics_spec.rb FIX: delete system generated message when user_export record is deleted (#7595) 2019-05-28 16:38:41 +05:30
cleanup_imap_sync_log_spec.rb DEV: Review fixes (#10641) 2020-09-10 13:41:46 +10:00
correct_missing_dualstack_urls_spec.rb DEV: Clean up S3 specs, stubs, and helpers 2020-09-28 12:02:25 +01:00
crawl_topic_link_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
create_missing_avatars_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
create_recent_post_search_indexes_spec.rb PERF: Create a partial regular post_search_data index on large sites. 2020-08-27 13:42:00 +08:00
create_user_reviewable_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
delete_replies_spec.rb FIX: jobs/delete_replies: Add Time+Duration, not Time+Time #9314 2020-04-03 09:23:40 +05:30
delete_topic_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
disable_bootstrap_mode_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
download_avatar_from_url_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
download_backup_email_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
download_profile_background_from_url_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
emit_web_hook_event_spec.rb FIX: Abort emit_web_hook_event job cleanly if web hook was deleted (#9445) 2020-04-16 21:24:09 +01:00
enable_bootstrap_mode_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
enqueue_digest_emails_spec.rb PERF: Do not enqueue digest emails when attempted recently (#10849) 2020-10-07 15:30:38 +01:00
enqueue_suspect_users_spec.rb FIX: Ignore suspect users that were migrated or users who were created more than six months ago (#9205) 2020-03-14 08:47:53 -03:00
ensure_s3_uploads_existence_spec.rb DEV: Clean up S3 specs, stubs, and helpers 2020-09-28 12:02:25 +01:00
export_csv_file_spec.rb DEV: Switch to new ExportUserArchive job 2020-08-28 11:46:53 -07:00
export_user_archive_spec.rb User export: profile as json, export auth token logs (#10819) 2020-10-06 15:51:53 -07:00
feature_topic_users_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
fix_out_of_sync_user_uploaded_avatar_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
fix_primary_emails_for_staged_users_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
fix_s3_etags_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
fix_user_usernames_and_groups_names_clash_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
grant_anniversary_badges_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
grant_new_user_of_the_month_badges_spec.rb FIX: Don't award new user of the month in the wrong month 2020-07-13 15:05:30 -04:00
heartbeat_spec.rb DEV: Replace `Time.new` with `Time.now` (#9142) 2020-03-09 17:37:49 +01:00
ignored_users_summary_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
invalidate_inactive_admins_spec.rb FEATURE: Add message to log when admins are automatically deactivated 2020-01-28 12:16:24 +00:00
invite_email_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
jobs_base_spec.rb DEV: Run jobs sequentially in test mode (#9897) 2020-05-28 12:52:27 +01:00
jobs_spec.rb Update rubocop to 2.3.1. 2020-07-24 17:19:21 +08:00
mass_award_badge_spec.rb FEATURE: Support uploading a csv with either user emails or usernames (#8971) 2020-02-18 10:53:12 -03:00
migrate_group_flair_images_spec.rb FIX: use `short_path` of flair upload to get signed url for secure media. 2020-06-05 07:43:15 +05:30
notify_mailing_list_subscribers_spec.rb FIX: don't send mailing list for post with empty content (#10577) 2020-09-03 08:58:25 +10:00
notify_moved_posts_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
notify_reviewable_spec.rb FIX: sync reviewable count when opening the hamburger menu (#10368) 2020-08-07 18:13:02 +02:00
notify_tag_change_spec.rb FIX: correct notification when tag or category is added (#8801) 2020-01-29 11:03:47 +11:00
old_keys_reminder_spec.rb FEATURE: notify admins about old credentials (#9918) 2020-06-01 13:49:27 +10:00
pending_queued_posts_reminder_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
pending_reviewables_reminder_spec.rb FEATURE: Hide Reviewable scores, change score filter to Priority 2019-05-07 14:05:23 -04:00
pending_users_reminder_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
periodical_updates_spec.rb DEV: Improve flaky time-sensitive specs (#9141) 2020-03-10 22:13:17 +01:00
poll_mailbox_spec.rb DEV: s/\$redis/Discourse\.redis (#8431) 2019-12-03 10:05:53 +01:00
post_uploads_recovery_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
process_bulk_invite_emails_spec.rb FEATURE: send max 200 emails every minute for bulk invites (#7875) 2019-07-19 11:29:12 +05:30
process_email_spec.rb FEATURE: Implement support for IMAP and SMTP email protocols. (#8301) 2020-07-10 12:05:55 +03:00
process_post_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
publish_topic_to_category_spec.rb SECURITY: Ensure users can see the topic before setting a topic timer. (#10841) 2020-10-06 16:49:06 -03:00
pull_hotlinked_images_spec.rb DEV: Clean up S3 specs, stubs, and helpers 2020-09-28 12:02:25 +01:00
purge_expired_ignored_users_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
rebake_custom_emoji_posts_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
reindex_search_spec.rb DEV: Refactor reindex_search_spec. 2020-07-24 09:29:54 +08:00
reviewable_priorities_spec.rb Tweak calculation for reviewable sensitivities/priorities 2019-09-19 14:07:56 -04:00
send_system_message_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
suspicious_login_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
tl3_promotions_spec.rb PERF: Dematerialize topic_reply_count (#9769) 2020-05-14 15:42:00 -07:00
toggle_topic_closed_spec.rb FIX: Clean up toggle closed topic timer when user is not authorized. 2020-08-26 12:59:05 +08:00
truncate_user_flag_stats_spec.rb DEV: Improve flaky time-sensitive specs (#9141) 2020-03-10 22:13:17 +01:00
unsilence_users_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
update_gravatar_spec.rb FIX: Gravatar download attempt if user is missing their email 2020-09-02 20:19:46 -06:00
update_s3_inventory_spec.rb DEV: Clean up S3 specs, stubs, and helpers 2020-09-28 12:02:25 +01:00
update_username_spec.rb FIX: Don't raise error in update username job if user has been deleted. 2020-09-02 11:17:17 +08:00
user_email_spec.rb PERF: Do not enqueue digest emails when attempted recently (#10849) 2020-10-07 15:30:38 +01:00
vacate_legacy_prefix_backups_spec.rb DEV: Clean up S3 specs, stubs, and helpers 2020-09-28 12:02:25 +01:00