Seems like (requires confirmation), querying the events (eth_getLogs) for a long block range may take a lot of time. Currently, this is somehow mitigated by doing a query starting from the contract creation block contract_creation_block(). Try to find a more optimized way to do that. Functions that require refactoring: