Closed nisnevich closed 1 year ago
Little but nice enchancement.
approve_grant_proposal uses inefficient code:
while grant_proposal.timer < GRANT_PROPOSAL_TIMER_SECONDS: await asyncio.sleep(GRANT_PROPOSAL_TIMER_SLEEP_SECONDS) grant_proposal.timer += GRANT_PROPOSAL_TIMER_SLEEP_SECONDS await db.commit()
Instead of storing timer value in DB, it's more efficient to store datetime object when the proposal was added, and so refactor approve_grant_proposal to just add GRANT_PROPOSAL_TIMER_SECONDS to it, and schedule grant() call with sched.scheduler.
But the method must exit whenever proposal is cancelled in on_raw_reaction_add.
LGTM, no plans to fix.
Little but nice enchancement.
approve_grant_proposal uses inefficient code:
Instead of storing timer value in DB, it's more efficient to store datetime object when the proposal was added, and so refactor approve_grant_proposal to just add GRANT_PROPOSAL_TIMER_SECONDS to it, and schedule grant() call with sched.scheduler.