File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 32
32
33
33
// for github crawling
34
34
githubToken string = ""
35
+
36
+ checkInterval time.Duration = 15 * time .Minute
35
37
)
36
38
37
39
func init () {
@@ -127,11 +129,16 @@ func main() {
127
129
for {
128
130
slog .DebugContext (ctx , "checking..." )
129
131
if err := content .Do (ctx , c ); err != nil {
130
- slog .ErrorContext (ctx , err .Error ())
131
- os .Exit (1 )
132
+ if ! errors .Is (err , content .ErrCouldNotContent ) {
133
+ slog .ErrorContext (ctx , err .Error ())
134
+ os .Exit (1 )
135
+ }
136
+ slog .DebugContext (ctx , "backing off..." )
137
+ break
138
+
132
139
}
133
140
134
- time .Sleep (5 * time . Minute )
141
+ time .Sleep (checkInterval )
135
142
}
136
143
return nil
137
144
},
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ package content
2
2
3
3
import (
4
4
"context"
5
- "fmt "
5
+ "errors "
6
6
"log/slog"
7
7
"strings"
8
8
@@ -13,7 +13,8 @@ import (
13
13
)
14
14
15
15
var (
16
- provider github.Provider
16
+ provider github.Provider
17
+ ErrCouldNotContent = errors .New ("could not get content" )
17
18
)
18
19
19
20
func Start (token string , cacheClient cache.Client ) error {
@@ -28,7 +29,8 @@ func Start(token string, cacheClient cache.Client) error {
28
29
func Do (ctx context.Context , c bluesky.Client ) error {
29
30
p , err := provider .GetContentToPublish ()
30
31
if err != nil {
31
- return fmt .Errorf ("could not get content: %v" , err )
32
+ slog .Error ("error fetching content" , slog .Any ("err" , err ))
33
+ return ErrCouldNotContent
32
34
}
33
35
34
36
if p == nil {
You can’t perform that action at this time.
0 commit comments