Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(plugins/aws-lambda): simplify code with tools.time utility #13413

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions kong/plugins/aws-lambda/handler.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
-- Copyright (C) Kong Inc.

local ngx_var = ngx.var
local ngx_now = ngx.now
local ngx_update_time = ngx.update_time
local md5_bin = ngx.md5_bin
local re_match = ngx.re.match
local fmt = string.format
Expand All @@ -17,6 +15,7 @@ local VIA_HEADER = constants.HEADERS.VIA
local server_tokens = meta._SERVER_TOKENS

local request_util = require "kong.plugins.aws-lambda.request-util"
local get_now = require("kong.tools.time").get_updated_now_ms
local build_request_payload = request_util.build_request_payload
local extract_proxy_response = request_util.extract_proxy_response
local remove_array_mt_for_empty_table = request_util.remove_array_mt_for_empty_table
Expand All @@ -30,12 +29,6 @@ local AWS
local LAMBDA_SERVICE_CACHE


local function get_now()
ngx_update_time()
return ngx_now() * 1000 -- time is kept in seconds with millisecond resolution.
end


local function initialize()
LAMBDA_SERVICE_CACHE = lrucache.new(1000)
AWS_GLOBAL_CONFIG = aws_config.global
Expand Down
Loading