Skip to content

🐛 Bug Report: Realtime create socket mutlitimes! #62

@gezihua123

Description

@gezihua123

👟 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions