Compare commits

..

No commits in common. "master" and "2.0.1" have entirely different histories.

5 changed files with 37 additions and 61 deletions

View File

@ -1,36 +0,0 @@
# .github/workflows/ci.yml
name: CI
on:
push:
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
env:
MY_DOCKER_USERNAME: ${{ secrets.MY_DOCKER_USERNAME }}
MY_DOCKER_PASSWORD: ${{ secrets.MY_DOCKER_PASSWORD }}
FORCE_COLOR: 1
steps:
- uses: https://github.com/earthly/actions-setup@v1
with:
version: v0.7.0
- uses: actions/checkout@v2
- name: Put back the git branch into git (Earthly uses it for tagging)
run: |
branch=""
if [ -n "$GITHUB_HEAD_REF" ]; then
branch="$GITHUB_HEAD_REF"
else
branch="${GITHUB_REF##*/}"
fi
git checkout -b "$branch" || true
- name: Docker Login
run: docker login git.hibas.dev --username "$MY_DOCKER_USERNAME" --password "$MY_DOCKER_PASSWORD"
- name: Earthly version
run: earthly --version
- name: Run build
run: earthly --push +docker-multi

32
Dockerfile Normal file
View File

@ -0,0 +1,32 @@
FROM node:19 as builder
RUN mkdir -p /app
WORKDIR /app
COPY ["package.json", "yarn.lock", ".yarnrc.yml", "tsconfig.json", "/app/"]
COPY [".yarn", "/app/.yarn"]
COPY ["src", "/app/src"]
RUN yarn install
RUN yarn build
FROM node:19
LABEL maintainer="Fabian Stamm <dev@fabianstamm.de>"
RUN mkdir -p /app
WORKDIR /app
ENV NODE_ENV=production
COPY ["package.json", "yarn.lock", ".yarnrc.yml", "/app/"]
COPY [".yarn", "/app/.yarn"]
RUN yarn install
COPY --from=builder /app/lib/ /app/lib
VOLUME [ "/app/logs", "/app/persist"]
CMD ["node", "lib/index.js"]

View File

@ -1,19 +0,0 @@
VERSION 0.7
FROM node:lts-alpine3.18
WORKDIR /build
docker-multi:
BUILD --platform linux/amd64 --platform linux/arm64 +docker
docker:
COPY package.json yarn.lock .yarnrc.yml tsconfig.json .
COPY src ./src
COPY .yarn ./.yarn
RUN ls -l
RUN yarn install
RUN yarn build
WORKDIR /build
ENTRYPOINT ["node", "lib/index.js"]
ARG EARTHLY_TARGET_TAG
ARG TAG=$EARTHLY_TARGET_TAG
SAVE IMAGE --push git.hibas.dev/hibas123/telegram-rss:$TAG

View File

@ -1,6 +1,6 @@
{
"name": "rss-telegram-bot",
"version": "2.0.3",
"version": "2.0.1",
"main": "lib/index.js",
"author": "Fabian Stamm <dev@fabianstamm.de>",
"license": "MIT",

View File

@ -98,12 +98,11 @@ async function checkFeed(feed: Feed) {
// feed.addItems(newItems);
}
const FEED_CHECK_INTERVAL = 1000 * 60 * 15;
// const FEED_CHECK_INTERVAL = 1000 * 30;
// const FEED_CHECK_INTERVAL = 1000 * 60 * 60;
const FEED_CHECK_INTERVAL = 1000 * 30;
export default async function checkFeeds() {
while (true) {
Logging.info("Checking for feeds to synchronize");
let feed = await AppDataSource.manager.findOne(Feed, {
where: {
lastCheck: LessThan(new Date(Date.now() - FEED_CHECK_INTERVAL))
@ -114,14 +113,14 @@ export default async function checkFeeds() {
})
if (!feed) {
await new Promise(y => setTimeout(y, 10000));
await new Promise(y => setTimeout(y, 1000));
continue;
}
feed.lastCheck = new Date();
await AppDataSource.manager.save(feed);
Promise.resolve().then(async () => {
Promise.resolve(async () => {
await checkFeed(feed);
}).catch(err => {
Logging.warn("Error while checking feed: %s", feed.url);