From b3dee65ba63d392ecf9179eecf28746103e427a0 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 19 Sep 2016 16:49:55 +0100 Subject: [PATCH] [Minor] Fix ASN caching --- src/plugins/lua/asn.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/lua/asn.lua b/src/plugins/lua/asn.lua index ea53a5303..737957053 100644 --- a/src/plugins/lua/asn.lua +++ b/src/plugins/lua/asn.lua @@ -63,9 +63,9 @@ local function asn_check(task) asn_set(parts[1], parts[2], parts[3]) if redis_params then - local redis_key = options.key_prefix .. ip + local redis_key = options.key_prefix .. ip:to_string() local ret,conn,upstream - local function redis_set_cb(task, err, data) + local function redis_asn_set_cb(task, err, data) if not err then upstream:ok() else @@ -99,10 +99,10 @@ local function asn_check(task) end local function asn_check_cache(ip, continuation_func) - local key = options.key_prefix .. ip + local key = options.key_prefix .. ip:to_string() local function redis_asn_get_cb(task, err, data) - if err or not data then + if err or not data or type(data[1]) ~= 'string' then continuation_func(ip) else asn_set(data[1], data[2], data[3]) -- 2.39.5