File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,23 @@ package handler
3
3
import (
4
4
"github.com/kataras/iris/v12"
5
5
"github.com/scutrobotlab/rm-schedule/internal/job"
6
+ "github.com/scutrobotlab/rm-schedule/internal/static"
6
7
"github.com/scutrobotlab/rm-schedule/internal/svc"
7
8
)
8
9
9
10
const (
11
+ GroupRankInfoStatic = false
10
12
GroupRankInfoCacheControl = "public, max-age=5"
11
13
)
12
14
13
15
func GroupRankInfoHandler (c iris.Context ) {
16
+ if GroupRankInfoStatic {
17
+ c .Header ("Cache-Control" , "no-cache" )
18
+ c .ContentType ("application/json" )
19
+ c .Write (static .GroupRankInfoBytes )
20
+ return
21
+ }
22
+
14
23
if c .GetHeader ("Tencent-Acceleration-Domain-Name" ) != "" {
15
24
c .Header ("Cache-Control" , GroupRankInfoCacheControl )
16
25
c .Redirect (job .GroupRankInfoUrl , 301 )
Original file line number Diff line number Diff line change @@ -13,20 +13,20 @@ const (
13
13
)
14
14
15
15
func ScheduleHandler (c iris.Context ) {
16
- // 是否存在 Tencent-Acceleration-Domain-Name
17
- if c .GetHeader ("Tencent-Acceleration-Domain-Name" ) != "" {
18
- c .Header ("Cache-Control" , ScheduleCacheControl )
19
- c .Redirect (job .ScheduleUrl , 301 )
20
- return
21
- }
22
-
23
16
if ScheduleStatic {
24
17
c .Header ("Cache-Control" , "no-cache" )
25
18
c .ContentType ("application/json" )
26
19
c .Write (static .ScheduleBytes )
27
20
return
28
21
}
29
22
23
+ // 是否存在 Tencent-Acceleration-Domain-Name
24
+ if c .GetHeader ("Tencent-Acceleration-Domain-Name" ) != "" {
25
+ c .Header ("Cache-Control" , ScheduleCacheControl )
26
+ c .Redirect (job .ScheduleUrl , 301 )
27
+ return
28
+ }
29
+
30
30
if cached , b := svc .Cache .Get ("schedule" ); b {
31
31
c .Header ("Cache-Control" , ScheduleCacheControl )
32
32
c .ContentType ("application/json" )
You can’t perform that action at this time.
0 commit comments