mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
deduping code and fixes for letsencrypt
This commit is contained in:
parent
06b74f3e8e
commit
1fc3120363
2 changed files with 12 additions and 2 deletions
0
public/banned_sites/.gitignore
vendored
0
public/banned_sites/.gitignore
vendored
|
@ -9,6 +9,16 @@ class LetsEncryptWorker
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform(site_id)
|
def perform(site_id)
|
||||||
|
|
||||||
|
# Dispose of dupes
|
||||||
|
|
||||||
|
queue = Sidekiq::Queue.new self.class.sidekiq_options_hash['queue']
|
||||||
|
queue.each do |job|
|
||||||
|
if job.args == [site_id] && job.jid != jid
|
||||||
|
job.delete
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
letsencrypt = Acme::Client.new(
|
letsencrypt = Acme::Client.new(
|
||||||
private_key: OpenSSL::PKey::RSA.new(File.read($config['letsencrypt_key'])),
|
private_key: OpenSSL::PKey::RSA.new(File.read($config['letsencrypt_key'])),
|
||||||
endpoint: $config['letsencrypt_endpoint']
|
endpoint: $config['letsencrypt_endpoint']
|
||||||
|
@ -32,8 +42,8 @@ class LetsEncryptWorker
|
||||||
attempts = 0
|
attempts = 0
|
||||||
|
|
||||||
begin
|
begin
|
||||||
raise VerificationTimeoutError if attempts == 5
|
raise VerificationTimeoutError if attempts == 30
|
||||||
raise NotAuthorizedYet if challenge.verify_status != 'valid'
|
raise NotAuthorizedYetError if challenge.verify_status != 'valid'
|
||||||
rescue NotAuthorizedYet
|
rescue NotAuthorizedYet
|
||||||
sleep 5
|
sleep 5
|
||||||
attempts += 1
|
attempts += 1
|
||||||
|
|
Loading…
Add table
Reference in a new issue