Registered functions running immediately
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript
Hướng nghiên cứu
Start with the shown tasks entry point and trace Task.registerHandler, Task.startPolling, and Task.findOneAndUpdate in the task package. Reproduce the restart and noon executions, then determine which scheduling step triggers them and document or correct the behavior with a regression test if the repository provides one.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I have a discord bot where one of the features is that on September 21st, it will send the youtube link the song "September". For some reason, these past two days it was running the task at noon. When trying to debug, it would also run on application restart. I'm wondering if there is an explanation to this behavior as I don't see why the code in its current state is allowing this behavior.
const db = require('../db');
const initTasks = require('@mongoosejs/task');
module.exports = async function tasks(bot) {
try {
const conn = await db().asPromise();
const setup = { db: conn }
initTasks(null, setup.db);
const { Task } = setup.db.models;
Task.registerHandler('september', function quirkMessage() {
return september(bot);
});
await Task.startPolling();
await Task.findOneAndUpdate({ name: 'september', status: 'pending' }, { scheduledAt: earthWindAndFire(), repeatAfterMS: millisecondsInYear }, { upsert: true, returnDocument: 'after' });
} catch(error) {
console.log('something went wrong registering all the handlers', error);
}
}
function earthWindAndFire() {
const date = new Date()
const year = date.getFullYear();
const septemberTwentyFirst = new Date(year, 8, 21, 19);
return septemberTwentyFirst;
}
- Ngôn ngữ chính
- JavaScript
- Star
- 4
- Fork
- 1
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
apex-dev-tools/apex-log-parser#199 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement good first issue hacktoberfest help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
ReadBufferStream.addBuffer adds the full ArrayBuffer of a typed array view, and ignores its byteOffsetCó thể đã có người làm @wayfarer3130 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Expo 57 example: pnpm install fails with ERR_PNPM_TRUST_DOWNGRADECó thể đã có người làm @github-actions đã nhận hôm nay. Đang mởbug react-native team/client-libraries
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
PostHog/posthog-js#5442 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày