0
측면 수행 방법에서 AC 파괴를 호출해도 안전합니까? 이 방법을 사용하면 장치를 통해 반복되어 알림을 보내고, 실패하면 구조에서 해당 장치가 파괴됩니다.수행 방법에서 객체를 파괴하려고 할 때의 Sidekiq 모범 사례
"devices = Device.where (id : device_ids)"이 줄 바로 다음에 일시 중지 될 수 있습니까? 스레드 A가 일시 중지 한 동일한 장치 객체를 스레드 B가 파괴했습니다. 스레드 A가 다시 시작될 때 "장치"가 다시 시작됩니다. 이미 파괴 되었나요? 이 문제를 해결하는 방법>
def perform(device_ids, message)
devices = Device.where(id: device_ids)
devices.each do |device|
begin
device.send_notification(message)
rescue Aws::SNS::Errors::EndpointDisabled
device.destroy
end
end
end