Skip to content

Commit 007f238

Browse files
authored
Merge pull request #5037 from samihda/main
Remove dependency `graceful`
2 parents a1020d6 + 43fe51b commit 007f238

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

changelog/issue-4594.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
audience: users
2+
level: silent
3+
reference: issue 4594
4+
---

clients/client-shell/cmds/signin/signin.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
package signin
33

44
import (
5+
"context"
56
"fmt"
67
"io/ioutil"
78
"net"
89
"net/http"
910
"net/url"
1011
"os"
1112
"strings"
12-
"time"
1313

1414
"github.com/pkg/browser"
1515
"github.com/spf13/cobra"
@@ -19,7 +19,6 @@ import (
1919
"github.com/taskcluster/taskcluster/v44/clients/client-go/tcauth"
2020
"github.com/taskcluster/taskcluster/v44/clients/client-shell/cmds/root"
2121
"github.com/taskcluster/taskcluster/v44/clients/client-shell/config"
22-
graceful "gopkg.in/tylerb/graceful.v1"
2322
)
2423

2524
var log = root.Logger
@@ -66,14 +65,11 @@ func cmdSignin(cmd *cobra.Command, _ []string) error {
6665
// Find port, choose 0 meaning random port, if none
6766
port, _ := cmd.Flags().GetInt("port")
6867

69-
// Setup server that we can shutdown gracefully
70-
s := graceful.Server{
71-
Timeout: 5 * time.Second,
72-
Server: &http.Server{},
73-
}
68+
// Set up server for the redirect page after a successful sign in
69+
s := http.Server{}
7470

7571
// Handle callback
76-
s.Server.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
72+
s.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
7773
qs := r.URL.Query()
7874
csh, _ := cmd.Flags().GetBool("csh")
7975
rootURL := config.RootURL()
@@ -101,7 +97,9 @@ func cmdSignin(cmd *cobra.Command, _ []string) error {
10197
</body>
10298
</html>
10399
`))
104-
s.Stop(50 * time.Millisecond)
100+
if err := s.Shutdown(context.Background()); err != nil {
101+
log.Errorf("Error shutting down server: %s\n", err)
102+
}
105103
})
106104

107105
// Start listening on localhost

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ require (
5656
golang.org/x/net v0.0.0-20210614182718-04defd469f4e
5757
golang.org/x/sys v0.0.0-20210510120138-977fb7262007
5858
golang.org/x/tools v0.1.5
59-
gopkg.in/tylerb/graceful.v1 v1.2.15
6059
gopkg.in/yaml.v2 v2.4.0
6160
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
6261
howett.net/plist v0.0.0-20201203080718-1454fab16a06 // indirect

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,6 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
422422
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
423423
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
424424
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
425-
gopkg.in/tylerb/graceful.v1 v1.2.15 h1:1JmOyhKqAyX3BgTXMI84LwT6FOJ4tP2N9e2kwTCM0nQ=
426-
gopkg.in/tylerb/graceful.v1 v1.2.15/go.mod h1:yBhekWvR20ACXVObSSdD3u6S9DeSylanL2PAbAC/uJ8=
427425
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
428426
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
429427
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

0 commit comments

Comments
 (0)