html-to-markdown icon indicating copy to clipboard operation
html-to-markdown copied to clipboard

Is `Converter` safe for use by multiple goroutines?

Open inliquid opened this issue 3 years ago • 1 comments

This should be documented. Is it safe to use by multiple goroutines? Am I expected to use one single instance of Converter with same configuration across my app, or to create new in each case? What's the design, what are performance considerations?

PS: there is sync.RWMutex within Converter struct, so the answer is probably yes, but, again, this should be documented to not guess or reverse engineer.

inliquid avatar Apr 19 '21 11:04 inliquid

@inliquid good catch, I definitely have to add documentation for this.

It's safe to use by multiple goroutines and you can use a single instance or multiple. Whatever you want.

There seems to be one test for that, but I definitely have to add more 🤔

JohannesKaufmann avatar May 11 '21 08:05 JohannesKaufmann