coinbase/toshi — pull request #64 by aalness (2014-09-17 23:42:42+00:00)
Title: Move where we delete 0confs to avoid blocking the tx processor

Deleting them in MemoryPool#remove_for_block means we're doing so prior to persisting all of the db records for the new block. The effect seems to be that Postgres locks the affected rows and the transaction processor gets blocked when it tries to mark unconfirmed spent outputs for new memory pool transactions until the block processor's db transaction commits -- after all of it's massive inserts. Spotted this phenomenon in the Postgres logs. This work around seems effective. I tested it on bitcoin.toshi.io.