mirror of
https://github.com/sot-tech/mochi.git
synced 2026-07-15 04:48:10 -07:00
Disable prometheus fot in-memory store if period set to 0
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
// Package directory implements container which
|
||||
// checks if hash present in any of *.torrent file
|
||||
// placed in some directory
|
||||
package directory
|
||||
|
||||
import (
|
||||
@@ -40,9 +43,8 @@ func build(confBytes []byte) (container.Container, error) {
|
||||
dir = c.BlacklistPath
|
||||
}
|
||||
var w *dirwatch.Instance
|
||||
w, err = dirwatch.New(dir)
|
||||
if w, err = dirwatch.New(dir); err != nil {
|
||||
return nil, fmt.Errorf("unable to initialize directory watch")
|
||||
return nil, fmt.Errorf("unable to initialize directory watch: %v", err)
|
||||
}
|
||||
lst.watcher = w
|
||||
go func() {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Package list implements container with pre-defined
|
||||
// list of torrent hashes from config file
|
||||
package list
|
||||
|
||||
import (
|
||||
@@ -35,14 +37,13 @@ func build(confBytes []byte) (container.Container, error) {
|
||||
|
||||
hashList := c.Whitelist
|
||||
if l.Invert {
|
||||
l.Invert = true
|
||||
hashList = c.Blacklist
|
||||
}
|
||||
|
||||
for _, hashString := range hashList {
|
||||
hashinfo, err := hex.DecodeString(hashString)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("whitelist : invalid hash %s", hashString)
|
||||
return nil, fmt.Errorf("whitelist : invalid hash %s, %v", hashString, err)
|
||||
}
|
||||
if len(hashinfo) != 20 {
|
||||
return nil, fmt.Errorf("whitelist : hash %s is not 20 byes", hashString)
|
||||
|
||||
Reference in New Issue
Block a user