Fixed potential issue with log file being empty.
This commit is contained in:
2
index.js
2
index.js
@@ -244,7 +244,7 @@ async function runAll() {
|
||||
for (const vpn of vpns) {
|
||||
const currentDate = new Date();
|
||||
const formattedDate = `${currentDate.getDate()}-${currentDate.getMonth() + 1}-${currentDate.getFullYear()}`;
|
||||
const logEntries = JSON.parse(fs.readFileSync('batch_logs.json', 'utf8'));
|
||||
const logEntries = JSON.parse(fs.readFileSync('batch_logs.json', 'utf8')) || [];
|
||||
const entry = logEntries.find(entries => entries.accountName === vpn);
|
||||
if (entry && entry.date === formattedDate) {
|
||||
logManager(`[${host}] ${vpn} already ran today!`, 'info');
|
||||
|
||||
Reference in New Issue
Block a user