kong icon indicating copy to clipboard operation
kong copied to clipboard

Defaults on queue.lua not working as expected

Open KalshuCodes opened this issue 1 year ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Kong version ($ kong version)

3.8.0.0

Current Behavior

Using queue.enqueue with queue config, instead of populating defaults from schema it is asserting the config directly causing queue to fail post concurrency_limit has been added, Need you to populate the defaults first when queue conf is passed in enqueue function

Expected Behavior

No response

Steps To Reproduce

No response

Anything else?

No response

KalshuCodes avatar Oct 04 '24 06:10 KalshuCodes

Yep, same here: kong-auth | 2024/10/07 16:35:21 [error] 241#0: *5153 failed to run log_by_lua*: /usr/local/share/lua/5.1/kong/tools/queue.lua:640: arg #1 (queue_conf) concurrency_limit must be a number kong-auth | stack traceback: kong-auth | [C]: in function 'assert' kong-auth | /usr/local/share/lua/5.1/kong/tools/queue.lua:640: in function 'enqueue' kong-auth | /usr/local/share/lua/5.1/kong/plugins/connect-auth/log.lua:347: in function 'execute' kong-auth | ...ocal/share/lua/5.1/kong/plugins/connect-auth/handler.lua:22: in function <...ocal/share/lua/5.1/kong/plugins/connect-auth/handler.lua:20> kong-auth | /usr/local/share/lua/5.1/kong/init.lua:465: in function 'execute_collected_plugins_iterator' kong-auth | /usr/local/share/lua/5.1/kong/init.lua:1831: in function 'log'

maxipavlovic avatar Oct 07 '24 16:10 maxipavlovic

IMO it's unclear whether the default value is for plugin configurations or the queue PDK APIs from the changelog. I suppose it's logical also to support the same default value for PDK calls. @vm-001 What do you think?

StarlightIbuki avatar Oct 08 '24 07:10 StarlightIbuki

@SomnolentKalash @maxipavlovic Are you using the queue.lua directly without defining the queue schema in the plugin schema?

Using enqueue directly requires providing all properties. The queue.lua is not yet part of the PDK, and has no backward compatibility guarantee.

The workaround would be

local queue_conf = {
  ...
  concurrency_limit = 1,
}
Queue.enqueue(queue_conf, handler, handler_conf, message)

vm-001 avatar Oct 08 '24 08:10 vm-001

This issue is marked as stale because it has been open for 14 days with no activity.

github-actions[bot] avatar Oct 28 '24 02:10 github-actions[bot]

This issue is marked as stale because it has been open for 14 days with no activity.

github-actions[bot] avatar Nov 14 '24 02:11 github-actions[bot]

Dear contributor,

We are automatically closing this issue because it has not seen any activity for three weeks. We're sorry that your issue could not be resolved. If any new information comes up that could help resolving it, please feel free to reopen it.

Your contribution is greatly appreciated!

Please have a look our pledge to the community for more information.

Sincerely, Your Kong Gateway team

github-actions[bot] avatar Nov 21 '24 02:11 github-actions[bot]