Skip to content

Conversation

@dani8art
Copy link
Contributor

Signed-off-by: Daniel Arteaga Barba darteaga@vmware.com

This PR is a proposal for the following issue:#2309 based in this comment: #2309 (comment)

…eased

Signed-off-by: Daniel Arteaga Barba <darteaga@vmware.com>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 22, 2022
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 22, 2022
Signed-off-by: Daniel Arteaga Barba <darteaga@vmware.com>
while (WebSocketStreamHandler.this.socket.queueSize() + byteString.size() > MAX_QUEUE_SIZE
&& attempts < MAX_QUEUE_SIZE_MAX_ATTEMPTS) {
try {
Thread.sleep(MAX_QUEUE_SIZE_WAIT_MILLISECONDS);
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than just straight sleeping, what do you think about using wait(MAX_TIME)/notify here. It would reduce latency and also be more efficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great suggestion! it is actually way long better

Using wait (~3min)

# exec 1
2022-09-27T14:12:16.502+0200 [    main][DEBUG] Copying /var/folders/v_/9khlk6_94hg0q1prl51fxbkh0000gp/T/12395450492776725845 to default:tests-c58fcf48c-n5w8f:/tmp
2022-09-27T14:15:44.043+0200 [    main][DEBUG] Copied /var/folders/v_/9khlk6_94hg0q1prl51fxbkh0000gp/T/12395450492776725845

# exec 2
2022-09-27T14:27:31.007+0200 [    main][DEBUG] Copying /var/folders/v_/9khlk6_94hg0q1prl51fxbkh0000gp/T/8625417876961582076 to default:tests-c58fcf48c-n5w8f:/tmp
2022-09-27T14:30:51.087+0200 [    main][DEBUG] Copied /var/folders/v_/9khlk6_94hg0q1prl51fxbkh0000gp/T/8625417876961582076

Using Thread.sleep (~4min)

# exec 1
2022-09-27T14:38:52.833+0200 [    main][DEBUG] Copying /var/folders/v_/9khlk6_94hg0q1prl51fxbkh0000gp/T/422416366883411235 to default:tests-c58fcf48c-n5w8f:/tmp
2022-09-27T14:42:23.119+0200 [    main][DEBUG] Copied /var/folders/v_/9khlk6_94hg0q1prl51fxbkh0000gp/T/422416366883411235

# exec 2
2022-09-27T15:24:35.732+0200 [    main][DEBUG] Copying /var/folders/v_/9khlk6_94hg0q1prl51fxbkh0000gp/T/2455455714318474992 to default:tests-c58fcf48c-n5w8f:/tmp
2022-09-27T15:28:35.794+0200 [    main][DEBUG] Copied /var/folders/v_/9khlk6_94hg0q1prl51fxbkh0000gp/T/tests-workplace-2455455714318474992

Signed-off-by: Daniel Arteaga Barba <darteaga@vmware.com>
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 27, 2022
@brendandburns
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 27, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, dani8art

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 27, 2022
@k8s-ci-robot k8s-ci-robot merged commit 7043ab5 into kubernetes-client:master Sep 27, 2022
@dani8art dani8art deleted the wait-before-adding-data-to-queue branch September 28, 2022 07:26
dani8art pushed a commit to dani8art/kubernetes-client-java that referenced this pull request Oct 21, 2022
…dding-data-to-queue

fix: WebSocketOutputStream wait to write until WebSocket queue is released
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants