directly use PurgeCacheWorker now

This commit is contained in:
Kyle Drake 2017-08-01 18:06:51 -07:00
parent f8db008a0d
commit b3a5b2d860
2 changed files with 8 additions and 8 deletions

View file

@ -650,15 +650,15 @@ class Site < Sequel::Model
# We gotta flush the dirname too if it's an index file. # We gotta flush the dirname too if it's an index file.
if relative_path != '' && relative_path.match(/\/$|index\.html?$/i) if relative_path != '' && relative_path.match(/\/$|index\.html?$/i)
PurgeCacheOrderWorker.perform_async username, relative_path PurgeCacheWorker.perform_async username, relative_path
purge_file_path = Pathname(relative_path).dirname.to_s purge_file_path = Pathname(relative_path).dirname.to_s
purge_file_path += '/' if purge_file_path != '/' purge_file_path += '/' if purge_file_path != '/'
PurgeCacheOrderWorker.perform_async username, '/?surf=1' if purge_file_path == '/' PurgeCacheWorker.perform_async username, '/?surf=1' if purge_file_path == '/'
PurgeCacheOrderWorker.perform_async username, purge_file_path PurgeCacheWorker.perform_async username, purge_file_path
else else
PurgeCacheOrderWorker.perform_async username, relative_path PurgeCacheWorker.perform_async username, relative_path
end end
end end
@ -667,14 +667,14 @@ class Site < Sequel::Model
def delete_cache(path) def delete_cache(path)
relative_path = path.gsub base_files_path, '' relative_path = path.gsub base_files_path, ''
DeleteCacheOrderWorker.perform_async username, relative_path PurgeCacheWorker.perform_async username, relative_path
# We gotta flush the dirname too if it's an index file. # We gotta flush the dirname too if it's an index file.
if relative_path != '' && relative_path.match(/\/$|index\.html?$/i) if relative_path != '' && relative_path.match(/\/$|index\.html?$/i)
purge_file_path = Pathname(relative_path).dirname.to_s purge_file_path = Pathname(relative_path).dirname.to_s
DeleteCacheOrderWorker.perform_async username, '/?surf=1' if purge_file_path == '/' PurgeCacheWorker.perform_async username, '/?surf=1' if purge_file_path == '/'
DeleteCacheOrderWorker.perform_async username, purge_file_path PurgeCacheWorker.perform_async username, purge_file_path
end end
end end

View file

@ -10,7 +10,7 @@ class PurgeCacheWorker
60 60
end end
def perform(proxy_ip, username, path) def perform(username, path)
# Must always have a forward slash # Must always have a forward slash
path = '/' + path if path[0] != '/' path = '/' + path if path[0] != '/'