removed db.json for cloud deployment

This commit is contained in:
Vadher
2026-07-19 17:20:56 +05:30
parent a15ec61607
commit 688075238a
2 changed files with 7 additions and 2093 deletions
+7 -7
View File
@@ -9,7 +9,7 @@ const { init, broadcast } = require("./utils/utils");
const urlPath = path.join(__dirname, "database", "urls.json");
dotenv.config();
const checkAllUrl = async (Store) => {
const checkAllUrl = async () => {
try {
const urls = await fs.readFile(urlPath, "utf8");
const parsedUrls = JSON.parse(urls);
@@ -18,10 +18,10 @@ const checkAllUrl = async (Store) => {
parsedUrls.map(async (url) => {
const response = await checkUrl(url);
broadcast(response);
Store.push(response);
// Store.push(response);
}),
);
StoreRecord(Store);
// StoreRecord(Store);
broadcast({ type: "checking" });
} catch (err) {
console.error("WebSocket polling error:", err.message);
@@ -33,15 +33,15 @@ const checkAllUrl = async (Store) => {
};
async function setupWebSocket(wss) {
init(wss);
let Store = [];
// let Store = [];
wss.on("connection", (ws) => {
checkAllUrl(Store);
checkAllUrl();
});
setInterval(
async () => {
Store = [];
checkAllUrl(Store);
// Store = [];
checkAllUrl();
},
process.env.TIME || 60 * 1000,
);