mirror of
https://github.com/neocities/neocities.git
synced 2025-08-05 09:11:28 +02:00
cache purge improvements, index path flusher
This commit is contained in:
parent
3a6ca6c12b
commit
4b87c818e7
6 changed files with 107 additions and 49 deletions
23
workers/purge_cache_order_worker.rb
Normal file
23
workers/purge_cache_order_worker.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
class PurgeCacheOrderWorker
|
||||
include Sidekiq::Worker
|
||||
sidekiq_options queue: :purgecacheorder, retry: 1000, backtrace: true, average_scheduled_poll_interval: 1
|
||||
|
||||
sidekiq_retry_in do |count|
|
||||
return 10 if count < 10
|
||||
180
|
||||
end
|
||||
|
||||
RESOLVER = Dnsruby::Resolver.new
|
||||
|
||||
def perform(username, path)
|
||||
if ENV['RACK_ENV'] == 'test'
|
||||
proxy_ips = ['10.0.0.1', '10.0.0.2']
|
||||
else
|
||||
proxy_ips = RESOLVER.query($config['cache_purge_ips_uri']).answer.collect {|a| a.address.to_s}
|
||||
end
|
||||
|
||||
proxy_ips.each do |proxy_ip|
|
||||
PurgeCacheWorker.perform_async proxy_ip, username, path
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue