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

🐛 Bug Report: Realtime create socket mutlitimes! #62

Open
2 tasks done
gezihua123 opened this issue Sep 25, 2024 · 0 comments
Open
2 tasks done

🐛 Bug Report: Realtime create socket mutlitimes! #62

gezihua123 opened this issue Sep 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@gezihua123
Copy link

gezihua123 commented Sep 25, 2024

👟 Reproduction steps

launch {
subCallDepth++
delay(DEBOUNCE_MILLIS)
if (subCallDepth == 1) {
createSocket()
}
subCallDepth--
}

when call this job in multiple threads ,it may call createSocket twice times or more?

👍 Expected behavior

when call this job in multiple threads ,it may call createSocket once. It will be ok by this code .

private var subCallDepth  = AtomicInteger(0)
delay(DEBOUNCE_MILLIS)

if (subCallDepth.compareAndSet(0,1)) {
    createSocket()
}

👎 Actual Behavior

it may call createSocket twice times or more?

🎲 Appwrite version

Appwrite Cloud

💻 Operating system

Linux

🧱 Your Environment

android

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@gezihua123 gezihua123 added the bug Something isn't working label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant