Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Starman3787 committed Mar 16, 2024
1 parent d7cb9ba commit 8ec3dc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,12 @@ class Client extends EventsEmitter {
}, 6000 * i);

if (this.cacheMessages == true || (this.cacheMembers == true && this.cacheAllMembers != true) || this.cacheUsers == true)
setInterval(() => {
setInterval(async () => {

const currentTime = Math.floor(new Date().getTime() / 1000);

const currentStorage = await this.storage.all();

if (this.cacheMessages == true || (this.cacheMembers == true && this.cacheAllMembers != true))
this.guilds.cache.forEach(guild => {

Expand All @@ -554,9 +556,9 @@ class Client extends EventsEmitter {

this.emit("debug", `New cache size of ${nowCached || 0} for CHANNEL ${guild.id}...`);

// const nowStored = await channel.messages.sweepStorage(currentTime);
const nowStored = await channel.messages.sweepStorage(currentTime, currentStorage);

// this.emit("debug", `New storage size of ${nowStored || 0} for CHANNEL ${guild.id}...`);
this.emit("debug", `New storage size of ${nowStored || 0} for CHANNEL ${guild.id}...`);

});

Expand Down
3 changes: 1 addition & 2 deletions src/managers/ChannelMessageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ class ChannelMessageManager {

}

async sweepStorage(currentTime) {
async sweepStorage(currentTime, currentStorage) {

const currentStorage = await this.storage.all();
const currentStorageSize = currentStorage.length;

for (let i = 0, cacheSize = currentStorageSize; i < currentStorageSize; i++) {
Expand Down

0 comments on commit 8ec3dc1

Please sign in to comment.