Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE]: increase the JOB time limit + save 100 msgs #132

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/functions/fetchMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,27 +152,27 @@ async function fetchMessages(
}
channel instanceof ThreadChannel
? await pushMessagesToArray(connection, messagesToStore, [...fetchedMessages.values()], {
threadId: channel.id,
threadName: channel.name,
channelId: channel.parent?.id,
channelName: channel.parent?.name,
})
threadId: channel.id,
threadName: channel.name,
channelId: channel.parent?.id,
channelName: channel.parent?.name,
})
: await pushMessagesToArray(connection, messagesToStore, [...fetchedMessages.values()]);
break;
}

channel instanceof ThreadChannel
? await pushMessagesToArray(connection, messagesToStore, [...fetchedMessages.values()], {
threadId: channel.id,
threadName: channel.name,
channelId: channel.parent?.id,
channelName: channel.parent?.name,
})
threadId: channel.id,
threadName: channel.name,
channelId: channel.parent?.id,
channelName: channel.parent?.name,
})
: await pushMessagesToArray(connection, messagesToStore, [...fetchedMessages.values()]);
await rawInfoService.createRawInfos(connection, messagesToStore);
options[fetchDirection] = boundaryMessage.id;
fetchedMessages = await channel.messages.fetch(options);
}
await rawInfoService.createRawInfos(connection, messagesToStore);
} catch (err) {
logger.error(
{ guild_id: connection.name, channel_id: channel.id, fetchDirection, err },
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
});

const partial =
(func: any, ...args: any) =>

Check warning on line 39 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type

Check warning on line 39 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type

Check warning on line 39 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type

Check warning on line 39 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type
(...rest: any) =>

Check warning on line 40 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type

Check warning on line 40 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type
func(...args, ...rest);

const fetchMethod = async (msg: any) => {

Check warning on line 43 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type

Check warning on line 43 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type
logger.info({ msg }, 'fetchMethod is running');
if (!msg) return;
const { content } = msg;
Expand Down Expand Up @@ -70,7 +70,7 @@
const guild = await client.guilds.fetch(guildId);
const channels = await guild.channels.fetch();

const arrayChannels = Array.from(channels, ([name, value]) => ({ ...value } as Channel));

Check warning on line 73 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

'name' is defined but never used

Check warning on line 73 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

'name' is defined but never used
const textChannels = arrayChannels.filter(channel => channel.type == ChannelType.GuildText) as TextChannel[];
const rawPositionBasedSortedTextChannels = textChannels.sort((textChannelA, textChannelB) =>
textChannelA.rawPosition > textChannelB.rawPosition ? 1 : -1
Expand Down Expand Up @@ -189,7 +189,7 @@
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const worker = new Worker(
'cronJobQueue',
async (job: Job<any, any, string> | undefined) => {

Check warning on line 192 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type

Check warning on line 192 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type

Check warning on line 192 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type

Check warning on line 192 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type
if (job) {
// Call the extractMessagesDaily function
await cronJob(client);
Expand All @@ -201,7 +201,7 @@
port: config.redis.port,
password: config.redis.password,
},
lockDuration: 7200000, // 2 hour
lockDuration: 79200000, // 22 hours
}
);

Expand Down
Loading