Class: Dontbugme::Store::Async

Inherits:
Base
  • Object
show all
Defined in:
lib/dontbugme/store/async.rb

Instance Method Summary collapse

Constructor Details

#initialize(backend) ⇒ Async

Returns a new instance of Async.



6
7
8
9
10
11
# File 'lib/dontbugme/store/async.rb', line 6

def initialize(backend)
  @backend = backend
  @queue = Queue.new
  @pid = Process.pid
  @thread = start_worker
end

Instance Method Details

#cleanup(before:) ⇒ Object



26
27
28
29
# File 'lib/dontbugme/store/async.rb', line 26

def cleanup(before:)
  restart_worker_if_forked
  @queue << [:cleanup, before]
end

#find_trace(trace_id) ⇒ Object



18
19
20
# File 'lib/dontbugme/store/async.rb', line 18

def find_trace(trace_id)
  @backend.find_trace(trace_id)
end

#save_trace(trace) ⇒ Object



13
14
15
16
# File 'lib/dontbugme/store/async.rb', line 13

def save_trace(trace)
  restart_worker_if_forked
  @queue << [:save, trace]
end

#search(filters = {}) ⇒ Object



22
23
24
# File 'lib/dontbugme/store/async.rb', line 22

def search(filters = {})
  @backend.search(filters)
end