diff --git a/kong/init.lua b/kong/init.lua index 45f09fc52d25..b0acb7dc2f84 100644 --- a/kong/init.lua +++ b/kong/init.lua @@ -289,6 +289,7 @@ function Kong.init() end --]] + assert(db:connect()) assert(db.plugins:check_db_against_config(config.loaded_plugins)) -- LEGACY @@ -344,19 +345,19 @@ function Kong.init() sort_plugins_for_execution(config, db, loaded_plugins) local err - plugins_map_semaphore, err = semaphore.new() + plugins_map_semaphore, err = semaphore.new(1) -- 1 = treat this as a mutex if not plugins_map_semaphore then error("failed to create plugins map semaphore: " .. err) end - plugins_map_semaphore:post(1) -- one resource, treat this as a mutex - local _, err = build_plugins_map(db, "init") if err then error("error building initial plugins map: ", err) end assert(runloop.build_router(db, "init")) + + assert(db:close()) end