pocketnetteam / pocketnet.core

Decentralized social network based on the blockchain
https://pocketnet.app
Apache License 2.0
115 stars 28 forks source link

Create a mechanism to process sql errors #496

Closed lostystyg closed 10 months ago

lostystyg commented 1 year ago

Currently if sql query fails (timeout or bad syntax) only log about error occurs. However, it is not possible to see if sql query was successful or not from the code that had executed the query. The destructive impact of this can be observed in search method. E.x. searching test on the testnet have a big chance to fail with timeout, but the result will be the empty array instead of error. The node will cache this for 60 blocks instead of producing an error to client. Thus, a mechanism of catching sql errors required.

andyoknen commented 10 months ago

I implemented the output of the full SQL text during execution timeout in this function: https://github.com/pocketnetteam/pocketnet.core/blob/7bbe372ddac6d5167c06e7407c58c0e1537ed217/src/pocketdb/repositories/BaseRepository.h#L90