Closed mumoshu closed 1 year ago
I have identified that there is a bug in the code causing std.out to be used instead of https://github.com/surrealdb/surrealdb.go/blob/main/pkg/logger/logger.go#L51C2-L51C2 when the path is empty. Rest assured, I will create a PR to fix this issue promptly. Thank you for bringing it to my attention.
The tests were failing time to time for me saying this:
The paniic points to https://github.com/surrealdb/surrealdb.go/blob/main/pkg/gorilla/gorilla.go#L205, and I see
ws.logger
beingnil
when the panic happens.We should make the logger non-nil, or make the
ws.read
goroutine wait until the logger is initialized. Otherwise, every timews.read
gets an error from the connection (e.g. the connection is closed?), AND the logger is nil (which is always the case for our no-optgorilla
ws impl in the tests), the panic happens.That's said, let's always initialize the logger for now.
We may make the logger getting lazily initialized on demand, but I think that's not a priority for now :)