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

Do not refresh cache if no update #3343

Merged
merged 4 commits into from
Aug 25, 2023
Merged

Conversation

gongmax
Copy link
Collaborator

@gongmax gongmax commented Aug 22, 2023

What type of PR is this?

Uncomment only one /kind <> line, press enter to put that in a new line, and remove leading whitespace from that line:

/kind breaking

/kind bug

/kind cleanup
/kind documentation
/kind feature
/kind hotfix
/kind release

What this PR does / Why we need it:
In the UpdateFunc, check whether there are actual change for the GameServer by checking the resourceVersion, and skip the allocation cache refresh for the GameServer if so. This prevents the race condition where a GS is Allocated and removed from the cache but the UpdateFunc adds it back with a stale state.

Which issue(s) this PR fixes:

Closes #

Special notes for your reviewer:

@github-actions github-actions bot added the kind/bug These are bugs. label Aug 22, 2023
@@ -70,6 +70,9 @@ func NewAllocationCache(informer informerv1.GameServerInformer, counter *gameser
if !ok {
return
}
if oldGs.ObjectMeta.ResourceVersion == newGs.ObjectMeta.ResourceVersion {
Copy link
Member

Choose a reason for hiding this comment

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

I like it! Good find!

Worth a unit test, or nah?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, I will add an unit test.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 97bb2b2c-958f-4cbe-94d7-5f69b470d551

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@google-oss-prow google-oss-prow bot added size/S and removed size/XS labels Aug 23, 2023
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 4c1dea12-c298-4426-8d75-2c314ea4ced0

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/3343/head:pr_3343 && git checkout pr_3343
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.35.0-dev-0ef9027-amd64

@gongmax gongmax requested review from markmandel and zmerlynn and removed request for cyriltovena and aLekSer August 24, 2023 17:02
@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gongmax, markmandel

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot removed the lgtm label Aug 24, 2023
@google-oss-prow
Copy link

New changes are detected. LGTM label has been removed.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 8c0de90a-dae6-4aa0-93e4-a38a93f554cd

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/3343/head:pr_3343 && git checkout pr_3343
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.35.0-dev-efff766-amd64

@markmandel markmandel merged commit 1f45f62 into googleforgames:main Aug 25, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants