Created
November 27, 2018 03:24
-
-
Save m-nakamura145/64a59cc9398e088b81592881e4f513ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'worker/base_worker' | |
class NotifyCancelledReservationWorker < BaseWorker | |
sidekiq_options queue: :reservation, retry: 3 | |
def perform(reservation_id) | |
reservation = Reservation.find(reservation_id) | |
reservation.notify_cancelled | |
end | |
end | |
# Bad Design | |
# | |
# class NotifyReservationStatusWorker < BaseWorker | |
# sidekiq_options queue: :reservation, retry: 3 | |
# | |
# def perform(reservation_id, status) | |
# reservation = Reservation.find(reservation_id) | |
# | |
# case status | |
# when 'cancelled' | |
# reservation.notify_cancelled | |
# when 'visited' | |
# reservation.notify_visited | |
# end | |
# end | |
# end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment