mirror of
https://salsa.debian.org/mdosch/feed-to-muc.git
synced 2024-11-22 14:08:39 +01:00
Made refresh time for feed queries configurable.
This commit is contained in:
parent
7e2c58256d
commit
e0d4613023
3 changed files with 15 additions and 2 deletions
|
@ -45,8 +45,14 @@ If the flag `-config` is not used the configuration is expected at
|
||||||
"Muc": "muc-to-feed@conference.example.com",
|
"Muc": "muc-to-feed@conference.example.com",
|
||||||
"MucNick": "feedbot",
|
"MucNick": "feedbot",
|
||||||
"MaxArticles": 5,
|
"MaxArticles": 5,
|
||||||
"NoExcerpt": false,
|
"RefreshTime": 30,
|
||||||
|
"NoExcerpt": false,
|
||||||
"Feeds": [ "https://www.debian.org/News/news",
|
"Feeds": [ "https://www.debian.org/News/news",
|
||||||
"https://www.debian.org/security/dsa-long" ]
|
"https://www.debian.org/security/dsa-long" ]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`MaxArticles` is the maximum number of articles that are sent per
|
||||||
|
feed and query. If `NoExcerpt` is set to *true* no excerpt will be
|
||||||
|
posted. `RefreshTime` defines the intervall for checking the feeds
|
||||||
|
in seconds.
|
|
@ -5,6 +5,7 @@
|
||||||
"Muc": "muc-to-feed@conference.example.com",
|
"Muc": "muc-to-feed@conference.example.com",
|
||||||
"MucNick": "feedbot",
|
"MucNick": "feedbot",
|
||||||
"MaxArticles": 5,
|
"MaxArticles": 5,
|
||||||
|
"RefreshTime": 30,
|
||||||
"NoExcerpt": false,
|
"NoExcerpt": false,
|
||||||
"Feeds": [ "https://www.debian.org/News/news",
|
"Feeds": [ "https://www.debian.org/News/news",
|
||||||
"https://www.debian.org/security/dsa-long" ]
|
"https://www.debian.org/security/dsa-long" ]
|
||||||
|
|
|
@ -36,6 +36,7 @@ func main() {
|
||||||
Muc string
|
Muc string
|
||||||
MucNick string
|
MucNick string
|
||||||
MaxArticles int
|
MaxArticles int
|
||||||
|
RefreshTime time.Duration
|
||||||
NoExcerpt bool
|
NoExcerpt bool
|
||||||
Feeds []string
|
Feeds []string
|
||||||
}
|
}
|
||||||
|
@ -144,6 +145,11 @@ func main() {
|
||||||
// Starting goroutine to process received stanzas.
|
// Starting goroutine to process received stanzas.
|
||||||
go processStanzas(client)
|
go processStanzas(client)
|
||||||
|
|
||||||
|
// Set RefreshTime to 30 seconds if not defined.
|
||||||
|
if config.RefreshTime == 0 {
|
||||||
|
config.RefreshTime = 30
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
// Check all configured feeds for new articles and send
|
// Check all configured feeds for new articles and send
|
||||||
// new articles to configured MUC.
|
// new articles to configured MUC.
|
||||||
|
@ -165,7 +171,7 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Wait 30 seconds before checking feeds again.
|
// Wait 30 seconds before checking feeds again.
|
||||||
time.Sleep(30 * time.Second)
|
time.Sleep(config.RefreshTime * time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue