Compare commits

..

No commits in common. "f1867c1010914d8c36898c39938a9d62f8fb6bff" and "a942e23b393c2ab7f819d1234153682add139d48" have entirely different histories.

3 changed files with 20 additions and 16 deletions

View File

@ -1,7 +1,8 @@
Copyright (c) 2017, Přemysl Janouch <p@janouch.name>
Copyright (c) 2017, Přemysl Janouch <p.janouch@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF

View File

@ -34,12 +34,16 @@ be run in a dedicated directory.
Contributing and Support
------------------------
Use https://git.janouch.name/p/gitea-obs to report any bugs, request features,
or submit pull requests. `git send-email` is tolerated. If you want to discuss
the project, feel free to join me at ircs://irc.janouch.name, channel #dev.
Bitcoin donations are accepted at: 12r5uEWEgcHC46xd64tt3hHt9EUvYYDHe9
or submit pull requests. If you want to discuss this project, or maybe just
hang out with the developer, feel free to join me at irc://irc.janouch.name,
channel #dev.
License
-------
This software is released under the terms of the 0BSD license, the text of which
is included within the package along with the list of authors.
'gitea-obs' is written by Přemysl Janouch <p.janouch@gmail.com>.
You may use the software under the terms of the ISC license, the text of which
is included within the package, or, at your option, you may relicense the work
under the MIT or the Modified BSD License, as listed at the following site:
http://www.gnu.org/licenses/license-list.html

15
main.go
View File

@ -191,8 +191,12 @@ func main() {
server := &http.Server{Addr: listenAddr}
// Run the producer
errs := make(chan error, 1)
go func() { errs <- server.ListenAndServe() }()
go func() {
if err := server.ListenAndServe(); err != nil &&
err != http.ErrServerClosed {
log.Fatalln(err)
}
}()
// Run the consumer
ctx, ctxCancel := context.WithCancel(context.Background())
@ -213,12 +217,7 @@ func main() {
// Wait for a termination signal
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
select {
case <-sigs:
case err := <-errs:
log.Println(err)
}
<-sigs
// Stop the producer gracefully
ctxSd, ctxSdCancel := context.WithTimeout(context.Background(), 5)