alphagov / trade-tariff-backend

Enabling the population and distribution via API of UK Customs tariffs and duties
MIT License
7 stars 6 forks source link

Marking failing updates #169

Closed rodzyn closed 10 years ago

rodzyn commented 10 years ago

Fixes problems with marking update as failed. In the previous solution, we were marking it, and then calling rollback (because of exception raised) - so the change was not stored in db. Currently we are marking them as failed in after_rollback sequel gem hook.

Some tests related to the bug above were hard to investigate because of transactional nature of rspec cleaning strategy, thus I flagged some of the test cases and setup truncation strategy for them.

Also, I noticed that at some point we can run into deadlock with our previous lock mechanism, and I found probably more stable and thread-safe solution to handle that.

I also did some refactoring.