Skip to content

Commit

Permalink
Merge pull request #65 from DarrenWestwood/add-address-expiry
Browse files Browse the repository at this point in the history
Stop checking unused addresses after 7 days
  • Loading branch information
DarrenWestwood authored May 29, 2023
2 parents 7bc5dfb + d78b1af commit 3587f80
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion blockonomics.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ def __del__(self):

def check_for_pending_transactions(self) -> None:

pending_addresses = [o.address for o in self.session.query(db.BtcTransaction.address).filter(db.BtcTransaction.status != 2)]
current_time = datetime.datetime.now()
one_week_ago = current_time - datetime.timedelta(days=7)

pending_addresses = [o.address for o in self.session.query(db.BtcTransaction.address).\
filter(db.BtcTransaction.status != 2,
db.BtcTransaction.timestamp > one_week_ago)]
if not pending_addresses: return

response = self._get_history_for_addresses(addresses=pending_addresses)
Expand Down

0 comments on commit 3587f80

Please sign in to comment.