StationA / tilenol

Scalable, multi-backend geo vector tile server
MIT License
22 stars 6 forks source link

[issue 39] Remove unneeded tx.Rollback. #44

Closed ccma14 closed 3 years ago

ccma14 commented 3 years ago

Description

This PR resolves issue #39, which is a case that gets hit if a tile request is canceled while we are still processing the BeginTx call.

In that case nil is returned for tx (and err is non-nil) and we crash as described in #39.

This PR fixes the issue by exiting runQuery if BeginTx returns an error and removing the call to tx.Rollback altogether.

Note that not calling tx.Rollback at all is OK because

This implies that the transaction will always be rolled back without an explicit call to tx.Rollback.

Thanks to @audreyyku and @jerluc for their help with this!