add timeout flag to refresh
This commit is contained in:
@@ -56,6 +56,7 @@ func main() {
|
|||||||
switch os.Args[1] {
|
switch os.Args[1] {
|
||||||
case "refresh":
|
case "refresh":
|
||||||
argCheck(c.Args(), 0, false, "'refresh' doesn't take an argument!")
|
argCheck(c.Args(), 0, false, "'refresh' doesn't take an argument!")
|
||||||
|
core.Timeout = *refreshTimeoutFlag
|
||||||
fetch.RefreshAll(&core.Data, *refreshWorkersFlag)
|
fetch.RefreshAll(&core.Data, *refreshWorkersFlag)
|
||||||
case "regenerate":
|
case "regenerate":
|
||||||
argCheck(c.Args(), 0, false, "'regenerate' doesn't take an argument!")
|
argCheck(c.Args(), 0, false, "'regenerate' doesn't take an argument!")
|
||||||
|
|||||||
+6
-1
@@ -28,10 +28,13 @@ var Data = FullData{
|
|||||||
// Maps are created in init()
|
// Maps are created in init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// the header of feeds.gmi.
|
// the Header of feeds.gmi.
|
||||||
// set in Init, either to the contents of header.gmi or to the default string
|
// set in Init, either to the contents of header.gmi or to the default string
|
||||||
var Header string
|
var Header string
|
||||||
|
|
||||||
|
// Timeout for requests
|
||||||
|
var Timeout int
|
||||||
|
|
||||||
// have to do this instead of the automatically called init() because
|
// have to do this instead of the automatically called init() because
|
||||||
// initialization stuff requires parsing of command line args first
|
// initialization stuff requires parsing of command line args first
|
||||||
func Init(dataPath string) error {
|
func Init(dataPath string) error {
|
||||||
@@ -88,6 +91,8 @@ func Init(dataPath string) error {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timeout = 10
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-2
@@ -33,7 +33,7 @@ variety of feed formats:
|
|||||||
automatically picked depending on the feed type. For Gemini feeds, the
|
automatically picked depending on the feed type. For Gemini feeds, the
|
||||||
first heading on a page is used as a title. For ATOM, RSS, and JSON feeds,
|
first heading on a page is used as a title. For ATOM, RSS, and JSON feeds,
|
||||||
the provided title is used. For a page being watched for changes, the URL
|
the provided title is used. For a page being watched for changes, the URL
|
||||||
itself is used.
|
itself is used. Use *-w* to watch a page for changes.
|
||||||
Also to note: when adding a new subscription, you *do not* need to run
|
Also to note: when adding a new subscription, you *do not* need to run
|
||||||
*refresh* afterwards, *add* will automatically fetch the entries and
|
*refresh* afterwards, *add* will automatically fetch the entries and
|
||||||
regenerate the .gmi and .json files.
|
regenerate the .gmi and .json files.
|
||||||
@@ -68,6 +68,10 @@ command-specific flags that are not universally recognized.
|
|||||||
the servers you're hitting and to other people on your network. Defaults to
|
the servers you're hitting and to other people on your network. Defaults to
|
||||||
5.
|
5.
|
||||||
|
|
||||||
|
*-t* _NUM_, *--timeout* _NUM_
|
||||||
|
Set a timeout for requests, in seconds. Defaults to 10 seconds per
|
||||||
|
request.
|
||||||
|
|
||||||
## ADD FLAGS
|
## ADD FLAGS
|
||||||
|
|
||||||
*-w*, *--watch*
|
*-w*, *--watch*
|
||||||
@@ -115,7 +119,9 @@ Within the data directory, the following files are used:
|
|||||||
*header.gmi*
|
*header.gmi*
|
||||||
This file is neither created nor modified by comitium. If it exists and is
|
This file is neither created nor modified by comitium. If it exists and is
|
||||||
nonempty, then it is read and used as custom header for *feed.gmi*. If it
|
nonempty, then it is read and used as custom header for *feed.gmi*. If it
|
||||||
doesn't exist or is empty, then a default header is used.
|
doesn't exist or is empty, then a default header is used. The generated
|
||||||
|
contents of *feed.gmi* will be appended to the contents of *header.gmi*
|
||||||
|
separated by one newline.
|
||||||
|
|
||||||
*feed.gmi*
|
*feed.gmi*
|
||||||
The outputted text/gemini file containing the subscription items. Is what
|
The outputted text/gemini file containing the subscription items. Is what
|
||||||
|
|||||||
@@ -52,6 +52,11 @@ var (
|
|||||||
`Number of worker threads to use when refreshing feeds. More is faster,
|
`Number of worker threads to use when refreshing feeds. More is faster,
|
||||||
but there are more concurrent outgoing requests then.`,
|
but there are more concurrent outgoing requests then.`,
|
||||||
)
|
)
|
||||||
|
refreshTimeoutFlag = commands["refresh"].IntP(
|
||||||
|
"timeout", "t",
|
||||||
|
10,
|
||||||
|
`Set a timeout for requests, in seconds.`,
|
||||||
|
)
|
||||||
|
|
||||||
// remove
|
// remove
|
||||||
removeFeedsFlag = commands["remove"].BoolP(
|
removeFeedsFlag = commands["remove"].BoolP(
|
||||||
|
|||||||
Reference in New Issue
Block a user