This method flushes the unsent reports and sessions upon being invoked.
Note: This method does not conform to the io.Closer interface because it
doesn't return an error.
I'm not a fan of this function returning an error in the first place, so
instead of propagating unnecessary
defer func(){_ = n.Close()}()
where the Close func never returns an error anyway just to adhere to the
interface, I decided to not return anything in the first place.
Additional changes:
Conform to a stricter "gofumports" formatting ruleset
Define a larger size for the buffered channels since both sessions and
error reports share the same select statement.
Stop flushing sessions in new goroutines, and get rid of the mutexes.
This method flushes the unsent reports and sessions upon being invoked. Note: This method does not conform to the io.Closer interface because it doesn't return an error. I'm not a fan of this function returning an error in the first place, so instead of propagating unnecessary defer func(){_ = n.Close()}() where the Close func never returns an error anyway just to adhere to the interface, I decided to not return anything in the first place.
Additional changes: