dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit bdc32365f2f47ba423ae930e5d827157b04690e5
parent 0b9781d44d59d9119453188cd74b230d33f67565
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Fri, 31 Jan 2025 18:33:46 -0800

cleanup

Diffstat:
Mpkg/actions/actions.go | 28+++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/pkg/actions/actions.go b/pkg/actions/actions.go @@ -79,22 +79,10 @@ func Start(c *cli.Context) error { utils.SGo(func() { cleanupDatabase(db) }) utils.SGo(func() { managers.ActiveUsers.CleanupUsersCache() }) + utils.SGo(func() { xmrCheck(db) }) utils.SGo(func() { xmrWatch(db) }) utils.SGo(func() { openBrowser(noBrowser, int64(port)) }) - go func() { - logrus.Info("start xmr check") - walletClient := config.Xmr() - poker.Refund(db) - if !walletIsBalanced(db, walletClient) { - // TODO: automatically send transactions that are not processed - config.PokerWithdrawEnabled.Store(false) - logrus.Error("wallet is not balanced") - dutils.RootAdminNotify(db, "wallet is not balanced; poker withdraw disabled") - } - logrus.Info("done xmr check") - }() - interceptors.LoadFilters(db) interceptors.ChessInstance = interceptors.NewChess(db) interceptors.BattleshipInstance = interceptors.NewBattleship(db) @@ -254,6 +242,20 @@ func (f LogFormatter) Format(e *logrus.Entry) ([]byte, error) { return buffer.Bytes(), nil } +// When the application starts, check that the wallet is balanced +func xmrCheck(db *database.DkfDB) { + logrus.Info("start xmr check") + walletClient := config.Xmr() + poker.Refund(db) + if !walletIsBalanced(db, walletClient) { + // TODO: automatically send transactions that are not processed + config.PokerWithdrawEnabled.Store(false) + logrus.Error("wallet is not balanced") + dutils.RootAdminNotify(db, "wallet is not balanced; poker withdraw disabled") + } + logrus.Info("done xmr check") +} + func xmrWatch(db *database.DkfDB) { var once utils.Once for {