Module: DocGenerationWrapper::Adapter::DocRaptorService::Proxy
- Extended by:
- Proxy
- Included in:
- Proxy
- Defined in:
- lib/doc_generation_wrapper/adapters/doc_raptor_service/proxy.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/doc_generation_wrapper/adapters/doc_raptor_service/proxy.rb', line 9
def method_missing method, *args
tries = 0
begin
DocRaptor.send method, *args
rescue Errno::ETIMEDOUT, Errno::ENOENT, Errno::ECONNRESET, Timeout::Error
(tries += 1) < 3 ? retry : raise
rescue DocRaptorException::DocumentCreationFailure => exception
if exception.message.match(/Too many simultaneous document requests/) && (tries+=1) < 5
wait_before_retrying && retry
else
raise
end
end
end
|
Instance Method Details
#wait_before_retrying ⇒ Object
24
25
26
27
|
# File 'lib/doc_generation_wrapper/adapters/doc_raptor_service/proxy.rb', line 24
def wait_before_retrying
Rails.logger.error '[DocGen] Docraptor can\'t accept more than 5 concurrent requests (auto-retry)'
sleep 5
end
|