Skip to content

Leaking bindings when the channel reply times out? #36

Description

@dustinconrad

In PhxPush.kt

/**
* Starts the Timer which will trigger a timeout after a specific delay
* in milliseconds is reached.
*/
fun startTimeout() {
this.timeoutTimer?.cancel()
val ref = this.channel.socket.makeRef()
this.ref = ref
val refEvent = this.channel.replyEventName(ref)
this.refEvent = refEvent
// If a response is received before the Timer triggers, cancel timer
// and match the received event to it's corresponding hook.
this.channel.on(refEvent) {
this.cancelRefEvent()
this.cancelTimeout()
this.receivedMessage = it
// Check if there is an event status available
val message = it
message.status?.let {
this.matchReceive(it, message)
}
}
// Start the timer. If the timer fires, then send a timeout event to the Push
this.timeoutTimer = Timer()
this.timeoutTimer?.schedule(timeout) {
trigger("timeout", HashMap())
}
}

I think what is happenign is that if the timeout actually happens then a Message like PhxMessage(ref=chan_reply_8, topic=, event=, payload={status=timeout}, joinRef=null) is triggered. This is fine. However the bindings created with this.channel.on(refEvent) are never removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions