crawshaw / sqlite

Go SQLite3 driver
ISC License
561 stars 67 forks source link

pool.Close() timeout setting #148

Closed nikkicoon closed 1 week ago

nikkicoon commented 1 week ago

should we be able to set the timeout for the pool at the initialization time of the pool? so far it's a fixed variable set at 5 seconds.

anacrolix commented 1 week ago

Are you referring to the Close timeout?

nikkicoon commented 1 week ago

yes, I'm wondering if it's something I need to catch on my side or if this could be changed. And what the reason behind 5 seconds is.

I think I found the error on my side, but I'm still interested in the reason behind not making this configurable.

anacrolix commented 1 week ago

The reason is Go's convention around Close is not clear on waiting for cleanup.

A good solution might be to add two methods: (Pool).StartClose(context.Context) error, and (Pool).WaitClosed(context.Context) or something to that effect.

You are welcome to submit a PR at https://github.com/go-llsqlite/crawshaw, an active fork myself and some others are maintaining.

nikkicoon commented 1 week ago

thanks for the explanation. I'll see if or when I get to submitting a patch.