Skip to content

参加者向けアナウンスのメール配信機能を実装#2747

Merged
takaishi merged 2 commits intopr2-ses-deliveryfrom
copilot/sub-pr-2741
Mar 14, 2026
Merged

参加者向けアナウンスのメール配信機能を実装#2747
takaishi merged 2 commits intopr2-ses-deliveryfrom
copilot/sub-pr-2741

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

Adds batch email delivery for published announcements, with delivery tracking and automatic dispatch on publish.

Schema

  • announcement_deliveries table — delivery queue/result log per profile
  • announcements gains send_status (pending/processing/completed), sent_count, failed_count
  • FK from announcement_deliveries → announcements with ON DELETE CASCADE

Delivery pipeline

  • Announcement#after_save triggers PrepareAnnouncementDeliveriesJob when publish flips to true
  • PrepareAnnouncementDeliveriesJob — resolves target_profiles by receiver type, creates deliveries idempotently inside a transaction via find_or_create_by!
  • SendAnnouncementBatchJob — sends BATCH_SIZE (default 10) emails per run, re-enqueues itself if remaining, marks completed when done
# Idempotent delivery creation with transaction safety
ActiveRecord::Base.transaction do
  profiles.each do |profile|
    AnnouncementDelivery.find_or_create_by!(announcement:, profile_id: profile.id) do |d|
      d.email = profile.email
      d.status = :queued
    end
  end
  announcement.update!(send_status: :processing)
end

Target resolution

Announcement#target_profiles returns the appropriate profile scope based on receiver:

  • all_attendee / only_online / only_offline / early_bird
  • Raises ArgumentError for unknown values

Admin UI

Announcement index shows send_status, sent_count, failed_count columns.

Other changes

  • JobHelper#sqs_queue_url: hardened env var resolution, uses Rails.logger instead of warn
  • Structured logging in both jobs for production observability
  • Local SQS queue name aligned to fifo.fifo

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…de, receiver validation

Co-authored-by: jacopen <79102+jacopen@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement announcement mailing feature for participants 参加者向けアナウンスのメール配信機能を実装 Mar 9, 2026
@jacopen jacopen marked this pull request as ready for review March 10, 2026 14:45
@jacopen jacopen requested a review from takaishi March 10, 2026 14:45
@gitops-for-cloudnativedays gitops-for-cloudnativedays bot added the reviewapps Build ReviewApp environment automatically if this label is granted label Mar 10, 2026
gitops-for-cloudnativedays bot added a commit to cloudnativedaysjp/dreamkast-infra that referenced this pull request Mar 10, 2026
commit: cloudnativedaysjp/dreamkast@7481a2b
action URL: https://github.com/cloudnativedaysjp/dreamkast/actions/runs/22840122490

Co-authored-by: gitops-for-cloudnativedays[bot] <113280573+gitops-for-cloudnativedays[bot]@users.noreply.github.com>
@github-actions
Copy link

@takaishi takaishi merged commit 639f82e into pr2-ses-delivery Mar 14, 2026
9 of 10 checks passed
@takaishi takaishi deleted the copilot/sub-pr-2741 branch March 14, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewapps Build ReviewApp environment automatically if this label is granted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants