Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
Falcon
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Walter Huang
Falcon
Commits
1d6237f2
Commit
1d6237f2
authored
Jul 04, 2025
by
Haohao Jiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: only trigger at Monday 11am in Beijing
parent
7b54de04
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
build.sh
build.sh
+2
-3
index.ts
index.ts
+17
-3
No files found.
build.sh
View file @
1d6237f2
docker build
-t
reg.i.strikingly.com/falcon:v0.7
.
docker push reg.i.strikingly.com/falcon:v0.7
\ No newline at end of file
docker build
-t
reg.i.strikingly.com/falcon:v0.7.2
.
docker push reg.i.strikingly.com/falcon:v0.7.2
index.ts
View file @
1d6237f2
...
...
@@ -15,7 +15,7 @@ async function main() {
if
(
shouldRun
)
{
task_trigger
=
"should_run_tasks"
;
await
redis
.
del
(
"falcon:should_run_tasks"
);
}
else
if
(
isMonday11AM
())
{
}
else
if
(
isMonday11AM
InBeijing
())
{
const
mondayKey
=
"falcon:monday_11am_executed"
;
const
alreadyExecuted
=
await
redis
.
get
(
mondayKey
);
if
(
alreadyExecuted
)
{
...
...
@@ -99,9 +99,23 @@ async function main() {
process
.
exit
(
0
);
}
function
isMonday11AM
()
{
function
isMonday11AM
InBeijing
()
{
const
now
=
new
Date
();
return
now
.
getDay
()
===
1
&&
now
.
getHours
()
===
11
;
// 获取北京时间的各项
const
formatter
=
new
Intl
.
DateTimeFormat
(
'zh-CN'
,
{
timeZone
:
'Asia/Shanghai'
,
hour12
:
false
,
weekday
:
'short'
,
hour
:
'2-digit'
});
const
parts
=
formatter
.
formatToParts
(
now
);
const
weekday
=
parts
.
find
(
p
=>
p
.
type
===
'weekday'
)?.
value
;
const
hour
=
Number
(
parts
.
find
(
p
=>
p
.
type
===
'hour'
)?.
value
);
console
.
log
(
'[isMonday11AMInBeijing] weekday:'
,
weekday
,
'hour:'
,
hour
);
// 周一11点
return
(
weekday
===
'周一'
||
weekday
===
'Mon'
)
&&
hour
===
11
;
}
// 调用入口
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment