Skip to content

Commit

Permalink
Remonter l'agent dans Sentry en cas d'erreur de sync Outlook
Browse files Browse the repository at this point in the history
  • Loading branch information
francois-ferrandis committed Jan 29, 2025
1 parent b4751b8 commit b1ba7cf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/jobs/outlook/mass_create_event_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ class MassCreateEventJob < ApplicationJob
queue_as :outlook_sync

def perform(agent)
Sentry.set_user({ id: agent.id, role: "Agent", email: agent.email })

agent.agents_rdvs.joins(:rdv).where(rdv: { starts_at: 1.month.ago.. }).find_each do |agents_rdv|
Outlook::SyncEventJob.perform_later_for(agents_rdv)
end
Expand Down
2 changes: 2 additions & 0 deletions app/jobs/outlook/mass_destroy_event_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ class MassDestroyEventJob < ApplicationJob
queue_as :outlook_sync

def perform(agent)
Sentry.set_user({ id: agent.id, role: "Agent", email: agent.email })

client = Outlook::ApiClient.new(agent)

agent.agents_rdvs.where.not(outlook_id: nil).each do |agents_rdv|
Expand Down
2 changes: 2 additions & 0 deletions app/jobs/outlook/sync_event_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def perform(agents_rdv_id, outlook_id, agent)
@outlook_id = outlook_id
@agent = agent

Sentry.set_user({ id: @agent.id, role: "Agent", email: @agent.email })

return unless agent.connected_to_outlook?

if event_should_be_in_outlook?
Expand Down

0 comments on commit b1ba7cf

Please sign in to comment.