mirror of
https://github.com/neocities/neocities.git
synced 2025-08-06 01:24:56 +02:00
clean up tests to reflect new purging code
This commit is contained in:
parent
d0936bce67
commit
9d3b86302d
8 changed files with 12 additions and 240 deletions
|
@ -1,20 +0,0 @@
|
|||
class DeleteCacheOrderWorker
|
||||
include Sidekiq::Worker
|
||||
sidekiq_options queue: :deletecacheorder, retry: 1000, backtrace: true, average_scheduled_poll_interval: 1
|
||||
|
||||
sidekiq_retry_in do |count|
|
||||
return 10 if count < 10
|
||||
180
|
||||
end
|
||||
|
||||
def perform(username, path)
|
||||
#proxy_ips = Resolv.getaddresses($config['cache_purge_ips_uri']).keep_if {|r| !r.match(/:/)}
|
||||
proxy_ips = $config['proxy_ips']
|
||||
|
||||
return if proxy_ips.nil? || proxy_ips.empty?
|
||||
|
||||
proxy_ips.each do |proxy_ip|
|
||||
DeleteCacheWorker.perform_async proxy_ip, username, path
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,21 +0,0 @@
|
|||
require 'open-uri'
|
||||
|
||||
# PurgeCacheWorker refreshes the cache, this actually deletes it.
|
||||
# This is because when the file is 404ing the PurgeCacheWorker
|
||||
# will just sit on the stale cache, even though it's not supposed to.
|
||||
# It's some nginx bug. I'm not going to deal with it.
|
||||
|
||||
class DeleteCacheWorker
|
||||
HTTP_TIMEOUT = 10
|
||||
include Sidekiq::Worker
|
||||
sidekiq_options queue: :deletecache, retry: 3, backtrace: false, average_scheduled_poll_interval: 1
|
||||
|
||||
sidekiq_retry_in do |count|
|
||||
return 10 if count < 10
|
||||
180
|
||||
end
|
||||
|
||||
def perform(proxy_ip, username, path)
|
||||
$redis_proxy.publish 'proxy', {cmd: 'purge', path: "#{username}#{path}"}.to_msgpack
|
||||
end
|
||||
end
|
|
@ -1,20 +0,0 @@
|
|||
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
|
||||
|
||||
def perform(username, path)
|
||||
proxy_ips = $config['proxy_ips']
|
||||
#proxy_ips = Resolv.getaddresses($config['cache_purge_ips_uri']).keep_if {|r| !r.match(/:/)}
|
||||
|
||||
return if proxy_ips.nil? || proxy_ips.empty?
|
||||
|
||||
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