-
Notifications
You must be signed in to change notification settings - Fork 10
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
issue with nodemon #186
Comments
Hi @kenenisa That's an expected behavior of nodemon, because it starts watching changes of files:
- Here is database option which defines the path for database file of sessions, for example example_db.json .telegraf-sessin-local uses underlying library called lowdb to store and manipulate database data.When you start your bot, lowdb creates new file descriptor for database -file and touches it (look onto file modification date-time just after starting nodemon or node ), which simply fires nodemon event like 'file was modified' and nodemon performing restart of your js file, which leads to looped behavior:--(1)-- Start js file and watch for changes by nodemon --(2)--> JS file started by node --(3)--> Bot started and touched database file --(4)--> Nodemon detected change of json file --(5)--> Nodemon re-executes js file --> (1)
To fix this, please add config for "nodemonConfig": {
"ignore": ["sessions.json", "example_db.json"]
}
telegraf-session-local/lib/session.js Line 15 in 43ab64d
|
The issue is resolved. It's now working as intended. |
Nodemon works perfectly but when I include
const LocalSession = require('telegraf-session-local')
it keeps failing to restart like:[nodemon] restarting due to changes... [nodemon] starting 'node index.js'
again and again.I'm using nodemon 2.0.15 and the latest telegraf-session-local version
The text was updated successfully, but these errors were encountered: