mirror of
https://github.com/LBRYFoundation/reflector.go.git
synced 2025-09-21 02:19:46 +00:00
fix livelock
adjust API endpoint
This commit is contained in:
parent
ebc52245f3
commit
ad710dfeea
2 changed files with 9 additions and 2 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -6,3 +6,7 @@
|
|||
blobcache.yaml
|
||||
|
||||
reflector.yaml
|
||||
|
||||
upload.yaml
|
||||
|
||||
remotereflector.yaml
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"golang.org/x/sync/singleflight"
|
||||
)
|
||||
|
||||
const protectedListURL = "https://api.odysee.com/file/list_protected"
|
||||
const protectedListURL = "https://direct.api.odysee.com/file/list_protected"
|
||||
|
||||
type ProtectedContent struct {
|
||||
SDHash string `json:"sd_hash"`
|
||||
|
@ -32,7 +32,10 @@ func GetProtectedContent() (interface{}, error) {
|
|||
Data []ProtectedContent `json:"data"`
|
||||
}
|
||||
|
||||
client := &http.Client{}
|
||||
// Bound the request to avoid hanging the entire request path.
|
||||
// Without a timeout, a slow or unreachable endpoint can block
|
||||
// singleflight callers indefinitely and stall HTTP handlers.
|
||||
client := &http.Client{Timeout: 5 * time.Second}
|
||||
req, err := http.NewRequest(method, protectedListURL, nil)
|
||||
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue