Compare commits
3 Commits
a942e23b39
...
f1867c1010
Author | SHA1 | Date | |
---|---|---|---|
f1867c1010 | |||
62de443d3b | |||
14be8d3d8e |
5
LICENSE
5
LICENSE
@ -1,8 +1,7 @@
|
|||||||
Copyright (c) 2017, Přemysl Janouch <p.janouch@gmail.com>
|
Copyright (c) 2017, Přemysl Janouch <p@janouch.name>
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
purpose with or without fee is hereby granted.
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
16
README.adoc
16
README.adoc
@ -34,16 +34,12 @@ be run in a dedicated directory.
|
|||||||
Contributing and Support
|
Contributing and Support
|
||||||
------------------------
|
------------------------
|
||||||
Use https://git.janouch.name/p/gitea-obs to report any bugs, request features,
|
Use https://git.janouch.name/p/gitea-obs to report any bugs, request features,
|
||||||
or submit pull requests. If you want to discuss this project, or maybe just
|
or submit pull requests. `git send-email` is tolerated. If you want to discuss
|
||||||
hang out with the developer, feel free to join me at irc://irc.janouch.name,
|
the project, feel free to join me at ircs://irc.janouch.name, channel #dev.
|
||||||
channel #dev.
|
|
||||||
|
Bitcoin donations are accepted at: 12r5uEWEgcHC46xd64tt3hHt9EUvYYDHe9
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
'gitea-obs' is written by Přemysl Janouch <p.janouch@gmail.com>.
|
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.
|
||||||
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
15
main.go
@ -191,12 +191,8 @@ func main() {
|
|||||||
server := &http.Server{Addr: listenAddr}
|
server := &http.Server{Addr: listenAddr}
|
||||||
|
|
||||||
// Run the producer
|
// Run the producer
|
||||||
go func() {
|
errs := make(chan error, 1)
|
||||||
if err := server.ListenAndServe(); err != nil &&
|
go func() { errs <- server.ListenAndServe() }()
|
||||||
err != http.ErrServerClosed {
|
|
||||||
log.Fatalln(err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Run the consumer
|
// Run the consumer
|
||||||
ctx, ctxCancel := context.WithCancel(context.Background())
|
ctx, ctxCancel := context.WithCancel(context.Background())
|
||||||
@ -217,7 +213,12 @@ func main() {
|
|||||||
// Wait for a termination signal
|
// Wait for a termination signal
|
||||||
sigs := make(chan os.Signal, 1)
|
sigs := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
||||||
<-sigs
|
|
||||||
|
select {
|
||||||
|
case <-sigs:
|
||||||
|
case err := <-errs:
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
|
||||||
// Stop the producer gracefully
|
// Stop the producer gracefully
|
||||||
ctxSd, ctxSdCancel := context.WithTimeout(context.Background(), 5)
|
ctxSd, ctxSdCancel := context.WithTimeout(context.Background(), 5)
|
||||||
|
Reference in New Issue
Block a user