Commit cfa3d899 authored by Krzysztof Leśniak's avatar Krzysztof Leśniak
Browse files

Wait for massive sync before calling next iteration

In the case `SIGINT` is delivered to hivemind process at the right moment
at the end of massive sync, it gets stuck.
This is because of a Postgres lock on `hivemind_app.accounts_view`.
Accounts indexer tries to acquire `AccessShareLock` to insert a new
account, but `AccessExclusiveLock` is already acquired by main sync loop.
This is because the end of current range is reached, which tries to
recreate `accounts_view` via the call chain:

```
self._query_for_app_next_block -> hive.app_next_iteration ->
hive.app_context_attach -> hive.create_accounts_view -> CREATE OR
REPLACE VIEW %s.accounts_view which takes an exclusive lock, which
blocks INSERT INTO hivemind_app.hive_accounts.
```

The solution is to wait for massive block consumption to complete before
starting next iteration.
parent 8cc9b77a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment