Skip to content

Commit

Permalink
Don't exit when email quota out
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelRobitaille committed Dec 31, 2024
1 parent 22f190c commit 6a93f4a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [3.0.1] 2024-12-31

### Fixes
- Fix regression that the process would exit when the email quota is up (#23)

## [3.0.0] 2024-11-18

### Breaking changes
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bbyen",
"version": "3.0.0",
"version": "3.0.1",
"description": "Bring Back YouTube Email Notifications!",
"main": "src/index.js",
"scripts": {
Expand Down
19 changes: 16 additions & 3 deletions src/videos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const getChannelsVideos = async ({
auth,
sendVideoEmail,
db,
}: IGetChannelsVideos) => {
}: IGetChannelsVideos): boolean => {
const { channelId, channelTitle, channelThumbnail } = channel

const videosSent = new Set((await db.all(SQL`
Expand Down Expand Up @@ -171,12 +171,14 @@ const getChannelsVideos = async ({
'Email quota has run out.',
'Abandoning, will retry on next timer trigger.',
)
process.exit(1)
return false;
}

logger.error(err)
}
}

return true;
}

interface IParseFeedsAndNotify {
Expand Down Expand Up @@ -213,7 +215,18 @@ export const parseFeedsAndNotify = async (
`${i + 1}/${channels.length}`,
`Checking channel ${channel.channelTitle} (${channel.channelId})`,
].join(' '))
await getChannelsVideos({ channel, parser, logger, db, ...rest })

const result = await getChannelsVideos({
channel,
parser,
logger,
db,
...rest
})

if (!result) {
return
}
}

logger.info('Finished checking for new videos')
Expand Down

0 comments on commit 6a93f4a

Please sign in to comment.