Skip to content

Commit

Permalink
Remove logs
Browse files Browse the repository at this point in the history
  • Loading branch information
haohanyang committed Dec 7, 2024
1 parent 6427579 commit 183172b
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions nodes/Reddit/RedditPostsReadTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class RedditPostsReadTrigger implements INodeType {
typeOptions: {
minValue: 1,
},
// eslint-disable-next-line n8n-nodes-base/node-param-default-wrong-for-limit
default: 10,
description: 'Max number of results to return',
},
Expand All @@ -65,14 +66,6 @@ export class RedditPostsReadTrigger implements INodeType {
async poll(this: IPollFunctions): Promise<INodeExecutionData[][] | null> {
const pollData = this.getWorkflowStaticData('node') as PollData;

this.logger.info(
pollData.lastRedditPostTimestamp ? pollData.lastRedditPostTimestamp.toString() : 'no data',
);
this.logger.info(pollData.lastRedditPostId ? pollData.lastRedditPostId : 'no data');
this.logger.info(
pollData.lastRedditPostSubreddit ? pollData.lastRedditPostSubreddit : 'no data',
);

const subreddit = this.getNodeParameter('subreddit') as string;
const itemLimit = this.getNodeParameter('limit') as number;

Expand Down Expand Up @@ -108,16 +101,13 @@ export class RedditPostsReadTrigger implements INodeType {
posts.sort((a: RedditPost, b: RedditPost) => b.created - a.created);

if (this.getMode() == 'manual') {
this.logger.info('manual trigger');
return [this.helpers.returnJsonArray(posts)];
}

if (!pollData.lastRedditPostTimestamp) {
this.logger.info(`init fetch ${pollData.lastRedditPostTimestamp}`);
if (posts.length > 0) {
pollData.lastRedditPostTimestamp = posts[0].created;
pollData.lastRedditPostId = posts[0].id;
this.logger.info(JSON.stringify(posts.map((e: any) => `${e.id}-${e.created}`)));
return [this.helpers.returnJsonArray(posts)];
}
return null;
Expand All @@ -130,8 +120,6 @@ export class RedditPostsReadTrigger implements INodeType {
if (newPosts.length > 0) {
pollData.lastRedditPostTimestamp = newPosts[0].created;
pollData.lastRedditPostId = newPosts[0].id;
this.logger.info('new posts');
this.logger.info(JSON.stringify(newPosts.map((e: any) => `${e.id}-${e.created}`)));

return [this.helpers.returnJsonArray(newPosts)];
}
Expand Down

0 comments on commit 183172b

Please sign in to comment.