arsyncer
arsyncer copied to clipboard
Closing syncer causes panics
Hi!
Calling Close()
closes internal channels, but it doesn't prevent sends on those internal channels.
Because of that I randomly see:
panic: send on closed channel
goroutine 68 [running]:
github.com/everFinance/arsyncer.(*Syncer).pollingBlock(0xc000178180)
/home/jan/work/redstone/syncer/.gopath~/pkg/mod/github.com/ever!finance/[email protected]/syncer.go:138 +0x506
created by github.com/everFinance/arsyncer.(*Syncer).Run
/home/jan/work/redstone/syncer/.gopath~/pkg/mod/github.com/ever!finance/[email protected]/syncer.go:83 +0x97
This is normal, close must be closed channel
Could you check if arsyncer.Close()
was called and avoid writing to a closed channel?
Could you check if
arsyncer.Close()
was called and avoid writing to a closed channel? It's just an exit process, we don't expect this method to be called during the code run, this method is only applicable inside the program exit process
You cannot call this method to pause arsyncer, arsyncer does not have a pause function
Yes, I'm calling Close()
only when our service is closing, but this isn't the problem.
The problem is that arsyncer is crashing the service when Close()
is called.
I call Close()
and wait till the SubscribeTx channel is closed. This way I'm sure all transactions pending in the channel get processed before our service is stopped.
Right now I call Close()
, arsyncer is crashing and all pending data is lost.
Would you accept a PR?
yes you can push a PR about this problem