kevburnsjr / microcache

A non-standard HTTP cache implemented as Go middleware
MIT License
155 stars 5 forks source link

Middleware fails to stop when monitor is absent #9

Closed kevburnsjr closed 5 years ago

kevburnsjr commented 5 years ago

Stumbled across this while testing something else.

Stop() hangs when no monitor is provided

kevburnsjr commented 5 years ago

Unfortunately, the monitor dictates the polling interval so it's impossible to completely initialize in anticipation of a monitor when monitor is nil. You can add a monitor after instantiating the struct, you just need to call Start explicitly. Start is idempotent. I don't see a way around this without changing the interface.