Skip to content

Commit

Permalink
Add a verification job
Browse files Browse the repository at this point in the history
  • Loading branch information
fractaledmind committed Aug 22, 2024
1 parent 10677a1 commit 8dd2f0b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/jobs/litestream/verification_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Litestream
class VerificationJob < ApplicationJob
queue_as Litestream.queue

def perform
Litestream::Commands.databases.each do |db_hash|
Litestream.verify!(db_hash["path"])
end
end
end
end
5 changes: 5 additions & 0 deletions lib/litestream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def initialize

mattr_writer :username
mattr_writer :password
mattr_writer :queue

class << self
def verify!(database_path)
Expand Down Expand Up @@ -60,6 +61,10 @@ def password
@password ||= ENV["LITESTREAM_PASSWORD"] || @@password
end

def queue
@queue ||= ENV["LITESTREAM_QUEUE"] || @@queue || "default"
end

def replicate_process
info = {}
if !`which systemctl`.empty?
Expand Down

0 comments on commit 8dd2f0b

Please sign in to comment.