Browse Source

fix not saving cache after unsubscribing

Mike L 3 years ago
parent
commit
572ef5e66f
2 changed files with 2 additions and 0 deletions
  1. 1 0
      dist/twitter.js
  2. 1 0
      src/twitter.ts

+ 1 - 0
dist/twitter.js

@@ -315,6 +315,7 @@ class default_1 {
                 logger.warn(`nobody subscribes thread ${currentFeed}, removing from feed`);
                 delete lock.threads[currentFeed];
                 (this.cache[parseLink(currentFeed).userName] || {}).pullOrder = 0;
+                fs.writeFileSync(path.resolve(this.cachefile), JSON.stringify(this.cache));
                 lock.feed.splice(lock.workon, 1);
                 fs.writeFileSync(path.resolve(this.lockfile), JSON.stringify(lock));
                 this.work();

+ 1 - 0
src/twitter.ts

@@ -548,6 +548,7 @@ export default class {
       logger.warn(`nobody subscribes thread ${currentFeed}, removing from feed`);
       delete lock.threads[currentFeed];
       (this.cache[parseLink(currentFeed).userName] || {} as {pullOrder: number}).pullOrder = 0;
+      fs.writeFileSync(path.resolve(this.cachefile), JSON.stringify(this.cache));
       lock.feed.splice(lock.workon, 1);
       fs.writeFileSync(path.resolve(this.lockfile), JSON.stringify(lock));
       this.work();