relayer icon indicating copy to clipboard operation
relayer copied to clipboard

do not make timeout for reading chan for NIP-5

Open mattn opened this issue 1 year ago • 3 comments

The timeout may make memory leak of chan since the chan is not pulled out. This may be leak of result set.

mattn avatar Nov 08 '23 14:11 mattn

Channels are garbage-collected, no? Even if they have stuff in them and are not closed.

fiatjaf avatar Nov 08 '23 15:11 fiatjaf

Regardless of that, I think removing the timeout is a good idea since these DB-reading operations shouldn't block forever anyway. If they do that's the symptom of a different problem.

fiatjaf avatar Nov 08 '23 15:11 fiatjaf

This channel has no buffer. Therefore, the transmission of the channel is blocked until the value is retrieved from the channel. Here a timeout may prevent a read from taking place. Then the transmission in the goroutine will be blocked and the rows.Close may not be executed.

mattn avatar Nov 11 '23 12:11 mattn