I'm using the following loop to try and add the metadata for tokens generated in my own smart contract, it all works exactly as intended when I am generating up to 9 "bots" at a time, but as soon as it's 10 or more, it doesn't seem to fire at all? Any idea as to why this could be? I know for a fact that the events are being emitted as I can see that in the smart contract.

Also, is this the best way to do this? Will this work with a real Ethereum infura node? Thanks a bunch!

def log_loop(newBot_filter, poll_interval):
    while True:
        for event in newBot_filter.get_new_entries():
            bot = event['args']
            dbh.add_bot(bot['_id'], ...)

newBot_filter = contract.events.NewBot.createFilter(fromBlock='latest')
Thread(target=log_loop, args=(newBot_filter, 2)).start()
  • Still not sure what's causing this but I optimized my contract and now I can do at least 15 without any problems (haven't tried a max amount). But I am guessing it had something to do with either the contract timing out or it moving on to the next block before it could be read. Really not sure. – Cobble Apr 16 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.