问题描述
我需要使作业每10分钟运行42次。我将使用具有以下cron语法的AWS Scheduled Task进行此操作:https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html
我想出的基本算术公式:
const arr = [{ "id": 5,"title": "buttercup","postContent": "dsdsfsfsfsfsfs","likedByMe": false,"likeCounts": 0,"userId": 1,"createdAt": "2020-08-17T03:41:16.749Z","updatedAt": "2020-08-17T03:41:16.749Z","author": { "username": "blankman","gravatar": "https://lh3.googleusercontent.com/a-/AOh14GiZAw_0UZmt7X0pJFSIv6ELQMd2nN41v0a-eKrN","bio": null },"Likes": [],"Comments": [{ "id": 46,"comment_body": "fsfsfsfsfsf","gifUrl": "","postId": 5,"createdAt": "2020-08-18T04:46:08.946Z","updatedAt": "2020-08-18T04:46:08.946Z","commentReplies": [{ "id": 18,"replyBody": "fsfsffsffsffsf","userId": 2,"commentId": 46,"createdAt": "2020-08-21T16:40:47.205Z","updatedAt": "2020-08-21T16:40:47.205Z","author": { "username": "barnowl","gravatar": null,"bio": null } }],"author": { "username": "blankman2","bio": null } },{ "id": 47,"author": { "username": "barnowl2","author": { "username": "blankman3",],"RePosts": [],"RepostedByMe": false }];
const res = arr.flatMap(x => [x.author.username].concat(x.Comments.flatMap(y => y.commentReplies.map(z => z.author.username).concat(y.author.username))));
console.log(res);
这意味着我希望计划任务在7个小时内每隔10分钟运行一次。一旦达到7个小时,它将在一天的剩余时间内不再运行。
鉴于此,我想出了这个表达式?
42 * 10 minutes = 420 minutes / 60 minutes = 7 hours.
这种表达方式对我的需求是否准确且最有效?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)