|
104 | 104 |
|
105 | 105 | -- get cert and key cdata with caching
|
106 | 106 | local function get_certkey_parsed(domain, typ)
|
107 |
| - local data, _ --[[stale]], _ --[[flags]] = certs_cache[typ]:get(domain) |
| 107 | + local data, data_staled, _ --[[flags]] = certs_cache[typ]:get(domain) |
108 | 108 |
|
109 | 109 | if data then
|
110 | 110 | return data, nil
|
@@ -142,6 +142,9 @@ local function get_certkey_parsed(domain, typ)
|
142 | 142 | -- fill in local cache
|
143 | 143 | if cache then
|
144 | 144 | certs_cache[typ]:set(domain, cache, CERTS_CACHE_TTL)
|
| 145 | + elseif err_ret and data_staled then |
| 146 | + log(ngx_WARN, err_ret, ", serving staled cert for ", domain) |
| 147 | + return data_staled, nil |
145 | 148 | else
|
146 | 149 | certs_cache[typ]:set(domain, null, CERTS_CACHE_NEG_TTL)
|
147 | 150 | end
|
@@ -269,7 +272,7 @@ function AUTOSSL.update_cert(data)
|
269 | 272 | AUTOSSL.storage:set(failure_count_key, count)
|
270 | 273 | local cooloff = AUTOSSL.config.failure_cooloff
|
271 | 274 | if failure_cooloff_callback then
|
272 |
| - cooloff = failure_cooloff_callback(domain, count) |
| 275 | + cooloff = failure_cooloff_callback(data.domain, count) |
273 | 276 | end
|
274 | 277 | local now = ngx.now()
|
275 | 278 | AUTOSSL.storage:add(failure_lock_key, now + cooloff, cooloff)
|
|
0 commit comments