Class: Ductr::SQLite::PollingTrigger

Inherits:
RufusTrigger
  • Object
show all
Defined in:
lib/ductr/sqlite/polling_trigger.rb

Overview

A trigger based on the RufusTrigger, runs the PollingHandler at the given timing. The handler calls the scheduler's method with a block which compares the yield result with the previous one. If they are different, yield returns true:

trigger :my_database, :polling, interval: "1min" def check_timestamp(db) # will perform MyJob if the name have changed return unless yield(db[:items].select(:name).first)

MyJob.perform_later

end

Instance Method Summary collapse

Instance Method Details

#stopvoid

This method returns an undefined value.

Closes the connection if the scheduler is stopped.



25
26
27
28
# File 'lib/ductr/sqlite/polling_trigger.rb', line 25

def stop
  super
  adapter.close!
end