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

fix(queue): function Queue.can_enqueue should handle non-existing queue instance correctly #13198

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

ADD-SP
Copy link
Contributor

@ADD-SP ADD-SP commented Jun 13, 2024

Summary

Treating the non-existing queue instance has enough capacity for enqueueing (fixup #13164)

Checklist

  • The Pull Request has tests
  • [N/A] A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • [N/A] There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

KAG-4270

@github-actions github-actions bot added the cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee label Jun 13, 2024
@ADD-SP ADD-SP changed the title fix(queue): function Queue.can_enqueue should handle non-existing queue instance correctly fix(queue): function Queue.can_enqueue should handle non-existing queue instance correctly Jun 13, 2024
@ADD-SP ADD-SP marked this pull request as ready for review June 13, 2024 02:59
kong/tools/queue.lua Outdated Show resolved Hide resolved
@ADD-SP ADD-SP force-pushed the add_sp/fix-queue-can-enqueue branch from 3055bbf to 66defc8 Compare June 13, 2024 03:27
@pull-request-size pull-request-size bot added size/S and removed size/M labels Jun 13, 2024
@ADD-SP ADD-SP requested a review from chronolaw June 13, 2024 03:39
Comment on lines 300 to 312
-- treat non-existing queues having enough capacity.
-- WARNING: The limitation is that if the `entry` is a string and the `queue.max_bytes` is set,
-- and also the `#entry` is larger than `queue.max_bytes`,
-- this function will incorrectly return `false` instead of `true`.
-- This is a limitation of the current implementation.
-- All capacity checking functions needs a Queue instance to work correctly.
-- consturcting a Queue instance just for this function is not efficient,
-- so we just return `true` here.
-- This limitation should not happen in normal usage,
-- as user should be aware of the queue capacity settings
-- to avoid such situation.
return true
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. changing this return value is safe for kong, cause currently there is no users calling this method in kong-ce.

kong/tools/queue.lua Outdated Show resolved Hide resolved
@ADD-SP ADD-SP force-pushed the add_sp/fix-queue-can-enqueue branch from 66defc8 to 4c8c715 Compare June 13, 2024 03:42
@ADD-SP ADD-SP merged commit 50f5a37 into master Jun 13, 2024
27 checks passed
@ADD-SP ADD-SP deleted the add_sp/fix-queue-can-enqueue branch June 13, 2024 05:02
@team-gateway-bot
Copy link
Collaborator

Successfully created cherry-pick PR for master:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee size/S skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants