-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cronjob to notify admin about missing solvers (#314) #563
base: main
Are you sure you want to change the base?
Conversation
- Schedule a daily job at midnight to check for solvers using `node-schedule`. - Implement `checkSolvers(bot)` to send a message to the community admin if no solvers are found. - Increment the count of messages sent to the admin in the database. - Add logic to disable the community if no solvers are added after a specified number of notifications. Fixes lnp2pBot#314
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @doitwithnotepad when it has to check if there are solvers it shows this in the logs :
error: Unhandled Rejection: TypeError: checkSolvers is not a function
It should now, 28360d2. |
@@ -7,6 +7,7 @@ const deleteOrders = require('./delete_published_orders'); | |||
const calculateEarnings = require('./calculate_community_earnings'); | |||
const deleteCommunity = require('./communities'); | |||
const nodeInfo = require('./node_info'); | |||
const checkSolvers = require('./check_solvers'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @doitwithnotepad please test the code before push a commit, that way you'll see if it works or not
we are getting the same error
error: Unhandled Rejection: TypeError: checkSolvers is not a function
this is because the function checkSolvers()
is not well imported, please replace with:
const { checkSolvers } = require('./check_solvers');
logger.info(`Community ${community._id} has been disabled due to lack of solvers.`); | ||
} else { | ||
await community.save(); | ||
const admin = await User.findOne({ tg_id: community.creator_id, admin: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user.admin
is only used for global admin, not community admins, we don't need to add it on this findOne()
request
Hi @doitwithnotepad which is the status of this PR? are you able to finish it? |
Hi @doitwithnotepad, are you able to finish this PR? The issue #314 is on the reward board , if you don't finish it, we should allow another dev to do it, and move it to status: looking for dev, what do you think? |
I can't do it right now, maybe later, sorry for the delay in answering. |
Schedule a daily job at midnight to check for solvers using
node-schedule
.Implement
checkSolvers(bot)
to send a message to the community admin if no solvers are found.Increment the count of messages sent to the admin in the database.
Add logic to disable the community if no solvers are added after a specified number of notifications.
Fixes #314