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

Defaults on queue.lua not working as expected #13729

Open
1 task done
SomnolentKalash opened this issue Oct 4, 2024 · 3 comments
Open
1 task done

Defaults on queue.lua not working as expected #13729

SomnolentKalash opened this issue Oct 4, 2024 · 3 comments

Comments

@SomnolentKalash
Copy link

Is there an existing issue for this?

  • 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

@maxipavlovic
Copy link
Contributor

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'

@StarlightIbuki
Copy link
Contributor

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?

@vm-001
Copy link
Member

vm-001 commented Oct 8, 2024

@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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants