Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Infinite loop in get_account_transactions #34

Open
ishfx opened this issue Jan 3, 2021 · 1 comment
Open

Infinite loop in get_account_transactions #34

ishfx opened this issue Jan 3, 2021 · 1 comment

Comments

@ishfx
Copy link

ishfx commented Jan 3, 2021

Hey,

I have a script using your wonderful library which has been working great so far.
When i ran it earlier this day, i got an unexpected result; it hang.

I had to dig to find out why it got into this state.

The issue comes from the method get_account_transactions.
https://github.com/tducret/revolut-python/blob/master/revolut/__init__.py#L186

get_account_transactions never breaks from the infinite loop because the revolut api always returns a transaction.
To be more precise, the first call to the api (so first loop) returns N transactions, to param is updated with the datetime of the last retrieved transaction, then the second loop (and those after) always return 1 transaction => stuck in loop.

I don't understand the need for the loop here, are there any specific cases ?

Right now, i just removed the loop to solve the issue because the first api call returns the requested transactions.

Thanks in advance.

@leikoilja
Copy link
Contributor

Thank you, @ishfx, for a good spot. Feel free to open a PR with changes, but make sure it accounts for transaction pagination. I agree with you that the loop is not well/safely implemented and can be refactored.
Maybe @cosmincc(2e816d2) can take a look at that?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants