Logged to SQL on exit

18 views
Skip to first unread message

Sean Mitchell

unread,
May 20, 2015, 8:56:15 AM5/20/15
to nod...@googlegroups.com
Hello,

I have a database setup to log errors etc. Problem is I get an error saying it can't be queued when quit has been invoked.

if (results.PaginationResult.TotalNumberOfPages === 0 || results.PaginationResult.TotalNumberOfEntries === 0) {
                                logEntry("No recent orders", "");
                                process.exit(1);
                            }

So the query is never executed

Aria Stewart

unread,
May 20, 2015, 9:06:56 AM5/20/15
to nod...@googlegroups.com, mitc...@hotmail.com

Indeed: you'll have to wait for the query to finish before exiting -- if you have no more IO queued, node will exit on its own (though with a success status).

I'd add a callback to your logEntry method, have it call back when your database writes finish, and then call process.exit there.
Reply all
Reply to author
Forward
0 new messages