wind-c / comqtt

A lightweight, high-performance go mqtt server(v3.0|v3.1.1|v5.0) supporting distributed cluster
MIT License
869 stars 50 forks source link

Goleak failing #58

Closed perbu closed 11 months ago

perbu commented 11 months ago

One last thing. Goleak seems to be in use. This sounds like a good idea, but it doesn't seem to be implemented correctly yet.

I've got no experience with it so I'm not sure if it serves a purpose. From the somewhat sparse documentation of Goleak, it seem the idea is to run some tests and then it'll go over the runtime and check if there are goroutines left.

If this is correct, I suggest we just delete main_test.go here.

Alternatively, I suspect we might need to refactor main() so it'll hand over control after setting up a context to something like main2() which would get the done-channel (or a ctx). Then write a test that takes up the process, send a couple of messages, and after that close the done-channel. Goleak, should than be able to check if we are able to clean up correctly.

Per.