Added logs to patch_collector
This commit is contained in:
@@ -3,8 +3,11 @@ import { MongoClient } from "mongodb";
|
|||||||
main()
|
main()
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const client = await connectToDatabase();
|
const client = await connectToDatabase()
|
||||||
const newPatch = await fetchLatestPatch();
|
const newPatch = await fetchLatestPatch()
|
||||||
|
|
||||||
|
console.log("Latest patch is: " + newPatch)
|
||||||
|
|
||||||
const newDate = new Date()
|
const newDate = new Date()
|
||||||
if(!(await compareLatestSavedPatch(client, newPatch, newDate))) {
|
if(!(await compareLatestSavedPatch(client, newPatch, newDate))) {
|
||||||
downloadAssets()
|
downloadAssets()
|
||||||
@@ -34,6 +37,8 @@ async function compareLatestSavedPatch(client: MongoClient, newPatch : string, n
|
|||||||
const patches = database.collection("patches")
|
const patches = database.collection("patches")
|
||||||
const latestPatch = await patches.find().limit(1).sort({date:-1}).next()
|
const latestPatch = await patches.find().limit(1).sort({date:-1}).next()
|
||||||
|
|
||||||
|
console.log("Latest patch in database is: " + latestPatch)
|
||||||
|
|
||||||
if(latestPatch.patch != newPatch) {
|
if(latestPatch.patch != newPatch) {
|
||||||
await patches.insertOne({patch:newPatch, date:newDate})
|
await patches.insertOne({patch:newPatch, date:newDate})
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user