Merge pull request 'sql' (#4) from sql into master

Reviewed-on: #4
This commit is contained in:
William Mantly 2024-01-07 06:39:14 +00:00
commit dc9f73961e
2 changed files with 5 additions and 2 deletions

View File

@ -89,6 +89,9 @@ module.exports = (sequelize, DataTypes, Model) => {
async getTorrentData(noUpdate){ async getTorrentData(noUpdate){
try{ try{
if(this.percentDone === 1) return this.dataValues
let res = ( await tr_client.get(this.hashString, [ let res = ( await tr_client.get(this.hashString, [
"eta", "percentDone", "status", "rateDownload", "eta", "percentDone", "status", "rateDownload",
"errorString", "hashString", 'name', "errorString", "hashString", 'name',
@ -103,9 +106,9 @@ module.exports = (sequelize, DataTypes, Model) => {
'sizeWhenDone', 'sizeWhenDone',
]) ).torrents[0]; ]) ).torrents[0];
if(this.percentDone === 1) return this.dataValues
await this.update(res); await this.update(res);
if(noUpdate) await this.save(); if(noUpdate) await this.save();
return {...res, ...this.dataValues}; return {...res, ...this.dataValues};
}catch(error){ }catch(error){
if(error.code === 'ECONNREFUSED'){ if(error.code === 'ECONNREFUSED'){

View File

@ -537,7 +537,7 @@
} }
}); });
} }
localStorage.clear('torrents'); localStorage.removeItem('torrents',);
} }
} }