mirror of
https://github.com/hacdias/webdav.git
synced 2026-09-26 05:01:54 +08:00
feat: add source request log (#71)
Co-authored-by: shenyuning <[email protected]> Co-authored-by: sxueck <[email protected]>
This commit is contained in:
co-authored by
shenyuning
sxueck
parent
099479a894
commit
9a4b378b32
@@ -1,12 +1,32 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/hacdias/webdav/v3/lib"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/hacdias/webdav/v3/cmd"
|
||||
)
|
||||
|
||||
func main() {
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
cmd.Execute()
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
go lib.LastRequestLogIndex(ctx)
|
||||
go cmd.Execute()
|
||||
|
||||
sigterm := make(chan os.Signal, 1)
|
||||
signal.Notify(sigterm, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
|
||||
|
||||
<-sigterm
|
||||
log.Println("receive stop signal")
|
||||
|
||||
cancel()
|
||||
// wait for other goroutines to quit
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user