Last active
December 30, 2015 21:09
-
-
Save TigerWolf/7885785 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
class PerformanceWorker | |
include Wisper | |
def perform | |
publish(:start_download, self) | |
PerformanceDownloader.new(url, attributes) | |
publish(:finish_download, self) | |
Transaction.start | |
publish(:import_start, self) | |
PerformancePurger.new(dbtable) | |
PerformnanceParser.new(attributes, dbtable) | |
publish(:import_finish, self) | |
Transaction.end | |
if transation_failed? | |
publish(:import_failed, self) | |
end | |
end | |
end | |
class Owner | |
def set_things_in_motion | |
worker = PerformanceWorker.new | |
worker.subscribe(WorkerLog.new) | |
worker.perform | |
end | |
end | |
class WorkerLog | |
def on_download_started(worker) | |
worker.log.update_attributes(:download_started, Time.now) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment