fix(CodeFeed): Fixed timestamp initialization and commit fetching timeframe
This commit is contained in:
@@ -12,7 +12,7 @@ export class CodeFeed {
|
||||
this.baseUrl = baseUrl;
|
||||
this.token = token;
|
||||
this.lastRunTimestamp =
|
||||
lastRunTimestamp || new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString();
|
||||
lastRunTimestamp || new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString();
|
||||
console.log('CodeFeed initialized with last run timestamp:', this.lastRunTimestamp);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ export class CodeFeed {
|
||||
owner: string,
|
||||
repo: string
|
||||
): Promise<plugins.interfaces.ICommit[]> {
|
||||
const twentyFourHoursAgo = new Date(Date.now() - 24 * 60 * 60 * 1000);
|
||||
const commitTimeframe = new Date(Date.now() - (7 * 24 * 60 * 60 * 1000));
|
||||
let page = 1;
|
||||
const recentCommits: plugins.interfaces.ICommit[] = [];
|
||||
|
||||
@@ -223,7 +223,7 @@ export class CodeFeed {
|
||||
|
||||
for (const commit of data) {
|
||||
const commitDate = new Date(commit.commit.author.date);
|
||||
if (commitDate > twentyFourHoursAgo) {
|
||||
if (commitDate > commitTimeframe) {
|
||||
recentCommits.push(commit);
|
||||
} else {
|
||||
return recentCommits;
|
||||
|
||||
Reference in New Issue
Block a user