Skip to content

Commit

Permalink
Merge pull request #13 from TokenMarketNet/voith-patch-1
Browse files Browse the repository at this point in the history
change dbsession.commit to dbsession.flush
  • Loading branch information
miohtama committed Aug 30, 2019
2 parents e5d33b5 + ceb5fe8 commit 6bae376
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions sto/ethereum/nonce.py
Expand Up @@ -44,7 +44,7 @@ def restart_nonce(logger: Logger,
account.current_nonce = tx_count

logger.info("Address %s, nonce is now set to %d", service.address, account.current_nonce)
dbsession.commit()
dbsession.flush()


def next_nonce(logger: Logger,
Expand All @@ -62,4 +62,4 @@ def next_nonce(logger: Logger,
service = EthereumStoredTXService(network, dbsession, web3, ethereum_private_key, ethereum_gas_price, ethereum_gas_limit, BroadcastAccount, PreparedTransaction)
account = service.get_or_create_broadcast_account()
ft = pretty_date(account.created_at)
logger.info("Address %s, created at %s, nonce is now set to %d", service.address, ft, account.current_nonce)
logger.info("Address %s, created at %s, nonce is now set to %d", service.address, ft, account.current_nonce)
4 changes: 2 additions & 2 deletions sto/ethereum/scanner.py
Expand Up @@ -286,7 +286,7 @@ def scan(self, start_block, end_block, start_chunk_size=20, progress_callback=Op
self.update_scan_status(start_block, current_end)

# Update database on the disk
self.dbsession.commit()
self.dbsession.flush()

# Print progress bar
if progress_callback:
Expand All @@ -300,7 +300,7 @@ def scan(self, start_block, end_block, start_chunk_size=20, progress_callback=Op

# Calculate balances to all accounts that have not seen new total since the last scan
status.update_denormalised_balances()
self.dbsession.commit() # Write latest balances
self.dbsession.flush() # Write latest balances

result = status.get_raw_balances(mutated_addresses)
return result
Expand Down
2 changes: 1 addition & 1 deletion sto/models/tokenscan.py
Expand Up @@ -58,7 +58,7 @@ class _TokenScanStatus(TimeStampedBaseModel):
#: All token balances are stored in raw amounts
decimals = sa.Column(sa.Integer, nullable=False, default=0)

#: Total supply, as stringified decimal
#: Total supply of this token as decimal serialised as string - for DB compatiblity issues
total_supply = sa.Column(sa.String(256), nullable=True)

def get_accounts(self, include_empty=False) -> Query:
Expand Down

0 comments on commit 6bae376

Please sign in to comment.