This file contains hidden or 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
function getItem() { | |
let node, text; | |
let output = ""; | |
let labels = ['roadmap']; | |
node = document.querySelector(".mat-dialog-content .roadmap-project-header-first-line"); | |
text = node.innerText; | |
output += "\nTitle: [Roadmap] " + text | |
const lines = document.querySelectorAll(".key-value-line"); |
This file contains hidden or 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
# every minute | |
subscribe "every_minute", 'bus_event_type' => 'heartbeat_minutes' do |attributes| | |
InvoiceChargeWorker.process_all! | |
end | |
# every hour: 4:22, 5:22, 6:22, etc | |
subscribe "once_an_hour", 'bus_event_type' => 'heartbeat_minutes', 'minute' => 22 do |attributes| | |
InvoiceChargeWorker.process_all! | |
end |
This file contains hidden or 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
namespace :resque do | |
task :setup => [:environment] do | |
require 'resque_scheduler' | |
require 'resque/scheduler' | |
require 'tresque' | |
QueueBus.heartbeat! | |
end | |
end |
This file contains hidden or 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
# for Tue, 11 Apr 2017 00:25:00 UTC +00:00 | |
# epoch time: 1491870300 | |
QueueBus.publish(heartbeat_seconds", { | |
"epoch_seconds"=>1491870300, | |
"epoch_minutes"=>24864505, | |
"epoch_hours"=>414408, | |
"epoch_days"=>17267, | |
"minute"=>25, | |
"hour"=>0, |
This file contains hidden or 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 InvoiceChargeWorker | |
include TResque::Worker | |
inputs :invoice_id | |
worker_lock :invoice_id | |
def self.process_all! | |
Invoice.where(stat: 'pending').find_each do |invoice| | |
self.enqueue(invoice_id: invoice.id) | |
end |
This file contains hidden or 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 InvoiceChargeBatchWorker | |
include TResque::Worker | |
worker_lock :all | |
queue_lock :all | |
def work | |
Invoice.where(stat: 'pending').find_each do |invoice| | |
InvoiceChargeWorker.enqueue(invoice_id: invoice.id) | |
end |
This file contains hidden or 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 InvoiceChargeWorker | |
include TResque::Worker | |
inputs :invoice_id | |
worker_lock :invoice_id | |
def work | |
return unless needed? | |
invoice.charge! | |
end |
This file contains hidden or 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 'resque/tasks' | |
require 'resque_scheduler/tasks' | |
require "resque_bus/tasks" | |
namespace :resque do | |
task :setup => [:environment] do | |
require 'resque_scheduler' | |
require 'resque/scheduler' | |
require 'tresque' | |
end |
This file contains hidden or 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 'tresque' | |
module Account | |
class RegularWorker | |
include ::TResque::Worker | |
# defaults to account_default queue | |
end | |
end | |
module Account |
This file contains hidden or 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
subscribe "user_changed" do |attributes| | |
UserIndexWorker.enqueue(user_id: attributes['id']) | |
end |
NewerOlder