Skip to content

Commit

Permalink
Limit processing to maximum defined by maxActionsProcessing
Browse files Browse the repository at this point in the history
  • Loading branch information
tcm390 committed Jan 4, 2025
1 parent 848e70a commit 7ad924b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/client-twitter/src/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,11 +627,12 @@ export class TwitterPostClient {

const homeTimeline = await this.client.fetchTimelineForActions();
const results = [];
let maxActionsProcessing =
let count = 0;
const maxActionsProcessing =
this.client.twitterConfig.MAX_ACTIONS_PROCESSING;

for (const tweet of homeTimeline) {
if (maxActionsProcessing >= 2) {
if (count >= maxActionsProcessing) {
break;
}
try {
Expand Down Expand Up @@ -925,7 +926,7 @@ export class TwitterPostClient {
parsedActions: actionResponse,
executedActions,
});
maxActionsProcessing++;
count++;
} catch (error) {
elizaLogger.error(
`Error processing tweet ${tweet.id}:`,
Expand Down

0 comments on commit 7ad924b

Please sign in to comment.