db: check info_hash record not found instead dropping all errors#118
Conversation
|
hi @da2ce7, the reason I did it that way is that:
I think I should first evaluate the impact of changing uncovered code in the future. I'm going to merge the PR. But I think what we really need to do is to add a new method like this:
so we can have this simpler version: We can probably use the current |
|
ACK 167b749 |
a3a1cca
into
torrust:issue-74-fix-api-response-for-duplicate-whitelist-requests
|
One more thing @da2ce7 do not you think we should simply "panic" when the SQL is wrong? I don't think we should try to handle those errors. I have to check that. It's strange that the DB package returns an error when the query does not have any result. I suppose the database trait should always return |
|
@josecelano The db error You are very correct to suggest that the DB should be rerunning an Optional Value to indicate that there was no record. – The code in this pull request is simply the minimal changes, without changing any of the interface... I just edited the db code because to correct their "unexpected" behavior, i.e. they didn't follow a reasonable interpenetration of their own contracts. |
5274b2c fix: [#74] send api ready event after starting the api server (Cameron Garnham) 15aa831 refactor: api job starter waits until api is ready (Jose Celano) 32a6d79 fix: [#74] send message from API when is ready (Jose Celano) ed5c1ed refactor: extract fn is_info_hash_whitelisted (Jose Celano) 8af9834 refactor: rename tests (Jose Celano) 167b749 db: check info_hash record not found instead dropping all errors (Cameron Garnham) 2d621c5 fix: [#74] bug calling the whitelist API endpoint twice (Jose Celano) 9cfab4d test: [#74] reproduce API bug with an e2e test (Jose Celano) Pull request description: - [x] Reproduce the error with an e2e test. - [x] Fix it. - [x] Rename test to `should_allow_to_whitelist_a_torrent` - [x] Refactor: extract function `is_info_hash_whitelisted` as described [here](#118 (comment)). ACKs for top commit: josecelano: ACK 5274b2c da2ce7: ACK 5274b2c Tree-SHA512: 82b5ed50816e09055bad14873a297ca847b7c7eb4b2707db4cce57a60bb54d2cb2122a1d6991f0d95079dc8353808556f4bdf30ccb225948c4dba871b452212a
No description provided.