Skip to content

Commit

Permalink
fix: allow process to fully exit when not running in daemon mode (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
louisgrasset authored Aug 14, 2023
1 parent 216803f commit c01075b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ if(DAEMON){
setInterval(async () => {
await touitomamout();
}, DAEMON_PERIOD_MIN * 60 * 1000);
}else {
process.exit(0);
}
3 changes: 2 additions & 1 deletion src/services/posts-synchronizer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const postsSynchronizerService = async (twitterClient: Scraper, mastodonC
try {
for (const tweet of tweets) {
const log = ora({ color: 'cyan', prefixText: oraPrefixer('content-sync') }).start();
log.text = 'filtering';

const medias = [
...tweet.photos.map(i => ({ ...i, type: 'image' })),
Expand All @@ -39,6 +38,8 @@ export const postsSynchronizerService = async (twitterClient: Scraper, mastodonC
if (mastodonClient || blueskyPost) {
synchronizedPostsCountThisRun.inc();
}

log.stop();
}

return {
Expand Down
2 changes: 1 addition & 1 deletion src/services/tweets-getter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const pullContentStats = (tweets: Tweet[], title: string) => {
export const tweetsGetterService = async (twitterClient: Scraper): Promise<Tweet[]> => {
const cache = await getCache();
const log = ora({ color: 'cyan', prefixText: oraPrefixer('content-mapper') }).start();
log.text = '...';
log.text = 'filtering';

// Get tweets from API
const tweets: Tweet[] = [];
Expand Down

0 comments on commit c01075b

Please sign in to comment.