lnbits / withdraw

LNbits Withdraw Extension
MIT License
6 stars 9 forks source link

Added paginated fetching to withdraw link table #41

Closed LoadJulz closed 1 month ago

LoadJulz commented 1 month ago

We had a severe bug in the Withdraw Extension that prevented us from using the UI. In our app, we handle many different users, and each user will eventually receive an LNURLw link. With thousands of links in the database, it was not very efficient to load all the links simultaneously. Many times we received a "502 Bad Gateway" error because the response took too long. This caused a significant chain reaction because our LNBits instance was completely down afterward, requiring us to reset with a backup to get things running again.

By implementing a paginated loading of the table, this issue would not occur anymore, and the Withdraw plugin would load much faster initially as well.

motorina0 commented 1 month ago

There is a built in pagination mechanism. See fetch_page in lnbits/core/crud.py. Any reason not to use that one.

LoadJulz commented 1 month ago

There is a built in pagination mechanism. See fetch_page in lnbits/core/crud.py. Any reason not to use that one.

What do you mean by built in pagination mechanism? The pagination mechanism in the LnBits repo is returning Payments and also the SQL statement looks fairly different. I don't see any advantage of reusing the LnBits code for the Withdraw plugin.