id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c164600 |
p.connsMu.Unlock()
return n
} | |
c164601 | delete(c.allNodes, addr)
collected = append(collected, node)
}
c.mu.Unlock()
for _, node := range collected {
_ = node.Client.Close()
}
} | |
c164602 | err := c.state.Reload()
return err
} | |
c164603 | }
}
}
for _, node := range state.Masters {
wg.Add(1)
go worker(node)
}
for _, node := range state.Slaves {
wg.Add(1)
go worker(node)
}
wg.Wait()
select {
case err := <-errCh:
return err
default:
return nil
}
} | |
c164604 | c.nodes.All()
if err != nil {
break
}
for _, node := range nodes {
_, err := node.Client.connPool.(*pool.ConnPool).ReapStaleConns()
if err != nil {
internal.Logf("ReapStaleConns failed: %s", err)
}
}
}
} | |
c164605 | _ = pubsub.Subscribe(channels...)
}
return pubsub
} | |
c164606 | tx.Close()
return err
}
}
err := fn(tx)
_ = tx.Close()
return err
} | |
c164607 | return c.baseClient.Close()
} | |
c164608 | args[0] = "watch"
for i, key := range keys {
args[1+i] = key
}
cmd := NewStatusCmd(args...)
c.Process(cmd)
return cmd
} | |
c164609 | pipe.statefulCmdable.setProcessor(pipe.Process)
return &pipe
} | |
c164610 |
return c.Pipeline().Pipelined(fn)
} | |
c164611 | error) {
return c.Pipelined(fn)
} | |
c164612 | val
cmd.setErr(err)
return &cmd
} | |
c164613 | {
var cmd SliceCmd
cmd.val = val
cmd.setErr(err)
return &cmd
} | |
c164614 | {
var cmd StatusCmd
cmd.val = val
cmd.setErr(err)
return &cmd
} | |
c164615 | {
var cmd IntCmd
cmd.val = val
cmd.setErr(err)
return &cmd
} | |
c164616 | DurationCmd
cmd.val = val
cmd.setErr(err)
return &cmd
} | |
c164617 | {
var cmd BoolCmd
cmd.val = val
cmd.setErr(err)
return &cmd
} | |
c164618 | {
var cmd StringCmd
cmd.val = val
cmd.setErr(err)
return &cmd
} | |
c164619 | {
var cmd FloatCmd
cmd.val = val
cmd.setErr(err)
return &cmd
} | |
c164620 | StringSliceCmd
cmd.val = val
cmd.setErr(err)
return &cmd
} | |
c164621 | BoolSliceCmd
cmd.val = val
cmd.setErr(err)
return &cmd
} | |
c164622 | StringStringMapCmd
cmd.val = val
cmd.setErr(err)
return &cmd
} | |
c164623 | *StringIntMapCmd {
var cmd StringIntMapCmd
cmd.val = val
cmd.setErr(err)
return &cmd
} | |
c164624 | {
var cmd ZSliceCmd
cmd.val = val
cmd.setErr(err)
return &cmd
} | |
c164625 |
cmd.cursor = cursor
cmd.setErr(err)
return &cmd
} | |
c164626 | ClusterSlotsCmd
cmd.val = val
cmd.setErr(err)
return &cmd
} | |
c164627 | GeoLocationCmd
cmd.locations = val
cmd.setErr(err)
return &cmd
} | |
c164628 | cmd CommandsInfoCmd
cmd.val = val
cmd.setErr(err)
return &cmd
} | |
c164629 | if shard.IsDown() {
return false
}
atomic.AddInt32(&shard.down, 1)
return shard.IsDown()
} | |
c164630 | shard.Vote(err == nil || err == pool.ErrPoolTimeout) {
internal.Logf("ring shard state changed: %s", shard)
rebalance = true
}
}
if rebalance {
c.rebalance()
}
}
} | |
c164631 | hash.Add(name)
shardsNum++
}
}
c.mu.Lock()
c.hash = hash
c.len = shardsNum
c.mu.Unlock()
} | |
c164632 | return PubSub with sticky error
panic(err)
}
return shard.Client.PSubscribe(channels...)
} | |
c164633 | {
select {
case errCh <- err:
default:
}
}
}(shard)
}
wg.Wait()
select {
case err := <-errCh:
return err
default:
return nil
}
} | |
c164634 | switch len(f) {
case 0:
o.DB = 0
case 1:
if o.DB, err = strconv.Atoi(f[0]); err != nil {
return nil, fmt.Errorf("invalid redis database number: %q", f[0])
}
default:
return nil, errors.New("invalid redis URL path: " + u.Path)
}
if u.Scheme == "rediss" {
o.TLSConfig = &tls.Config{ServerName: h}
}
r... | |
c164635 | c.channels = make(map[string]struct{})
}
for _, s := range channels {
c.channels[s] = struct{}{}
}
return err
} | |
c164636 | c.patterns = make(map[string]struct{})
}
for _, s := range patterns {
c.patterns[s] = struct{}{}
}
return err
} | |
c164637 |
delete(c.channels, channel)
}
err := c.subscribe("unsubscribe", channels...)
return err
} | |
c164638 |
delete(c.patterns, pattern)
}
err := c.subscribe("punsubscribe", patterns...)
return err
} | |
c164639 | return c.cmd.readReply(rd)
})
c.releaseConn(cn, err, timeout > 0)
if err != nil {
return nil, err
}
return c.newMessage(c.cmd.Val())
} | |
c164640 | // Ignore.
case *Message:
return msg, nil
default:
err := fmt.Errorf("redis: unknown message: %T", msg)
return nil, err
}
}
} | |
c164641 | && strings.HasPrefix(err.Error(), "NOSCRIPT ") {
return s.Eval(c, keys, args...)
}
return r
} | |
c164642 | append(c.cmds, cmd)
c.mu.Unlock()
return nil
} | |
c164643 | = true
c.mu.Unlock()
return nil
} | |
c164644 |
err := c.discard()
c.mu.Unlock()
return err
} | |
c164645 | nil, nil
}
cmds := c.cmds
c.cmds = nil
return cmds, c.exec(cmds)
} | |
c164646 | RandomSlot()
}
key = Key(key)
return int(crc16sum(key)) % slotNumber
} | |
c164647 | having a flag indicating no rotation.
rotationFrequency: time.Hour * 8760 * 100,
idTokenValidFor: time.Hour * 8760 * 100,
key: func() (*rsa.PrivateKey, error) { return key, nil },
}
} | |
c164648 | idTokenValidFor,
key: func() (*rsa.PrivateKey, error) {
return rsa.GenerateKey(rand.Reader, 2048)
},
}
} | |
c164649 | }
}
go func() {
for {
select {
case <-ctx.Done():
return
case <-time.After(time.Second * 30):
if err := rotater.rotate(); err != nil {
s.logger.Errorf("failed to rotate keys: %v", err)
}
}
}
}()
return
} | |
c164650 | make(map[string]storage.Password),
offlineSessions: make(map[offlineSessionID]storage.OfflineSessions),
connectors: make(map[string]storage.Connector),
logger: logger,
}
} | |
c164651 | {
return New(logger), nil
} | |
c164652 | strings.HasSuffix(u.Host, "."+host) {
return true
}
}
}
return false
} | |
c164653 |
clientID := c.ClientID
return &oidcConnector{
redirectURI: c.RedirectURI,
oauth2Config: &oauth2.Config{
ClientID: clientID,
ClientSecret: c.ClientSecret,
Endpoint: provider.Endpoint(),
Scopes: scopes,
RedirectURL: c.RedirectURI,
},
verifier: provider.Verifier(
&oidc.Config{C... | |
c164654 | (connector.Identity, error) {
return identity, nil
} | |
c164655 | {
return c.openConnector(logger)
} | |
c164656 | of the Response was not Success, was %q", lastPart)
statusMessage := status.StatusMessage
if statusMessage != nil && statusMessage.Value != "" {
errorMessage += " -> " + statusMessage.Value
}
return fmt.Errorf(errorMessage)
}
return nil
} | |
c164657 | {
return now.Add(allowedClockDrift).Before(notBefore)
} | |
c164658 | {
return now.After(notOnOrAfter.Add(allowedClockDrift))
} | |
c164659 | http.ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).Dial,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
},
}, nil
} | |
c164660 |
// These values are prescribed depending on the ECDSA key type. We
// can't return different values.
switch key.Params() {
case elliptic.P256().Params():
return jose.ES256, nil
case elliptic.P384().Params():
return jose.ES384, nil
case elliptic.P521().Params():
return jose.ES512, nil
default:
... | |
c164661 | err != nil {
return nil, err
}
return cli, nil
} | |
c164662 | case <-ctx.Done():
return errors.New("timed out waiting for CRDs to be available")
case <-time.After(time.Millisecond * 100):
}
}
}
return nil
} | |
c164663 | %v", name, err)
}
conds := make(map[string]string) // For debugging, keep the conditions around.
for _, c := range r.Status.Conditions {
if c.Type == k8sapi.Established && c.Status == k8sapi.ConditionTrue {
return nil
}
conds[string(c.Type)] = string(c.Status)
}
return fmt.Errorf("crd %s not ready %#v",... | |
c164664 | this, we can run this in a transaction with a get beforehand.
n, err := result.RowsAffected()
if err != nil {
return fmt.Errorf("rows affected: %v", err)
}
if n < 1 {
return storage.ErrNotFound
}
return nil
} | |
c164665 | (storage.Storage, error) {
return p.open(logger)
} | |
c164666 | c.RedirectURI,
clientID: c.ClientID,
clientSecret: c.ClientSecret,
logger: logger,
}, nil
} | |
c164667 | &callback{logger: logger, pathSuffix: "/" + id}, nil
} | |
c164668 | u.Path + m.pathSuffix
v := u.Query()
v.Set("state", state)
u.RawQuery = v.Encode()
return u.String(), nil
} | |
c164669 | ERROR: type should be string, got " https://kubernetes.io/docs/admin/authentication/#authenticating-proxy\n\treturn connector.Identity{\n\t\tUserID: remoteUser, // TODO: figure out if this is a bad ID value.\n\t\tEmail: remoteUser,\n\t\tEmailVerified: true,\n\t}, nil\n}" | |
c164670 | func() string { return c.logoURL },
"url": func(s string) string { return join(c.issuerURL, s) },
"lower": strings.ToLower,
}
tmpls, err := template.New("").Funcs(funcs).ParseFiles(filenames...)
if err != nil {
return nil, fmt.Errorf("parse files: %v", err)
}
missingTmpls := []string{}
for _, tmplNa... | |
c164671 | string {
return idToName(s, c.hash)
} | |
c164672 | return offlineTokenName(userID, connID, c.hash)
} | |
c164673 | r.Body)
r.Body.Close()
} | |
c164674 | if t, ok := arg.(time.Time); ok {
args[i] = t.UTC()
}
}
return args
} | |
c164675 |
if err != nil {
return err
}
if err := fn(&trans{sqlTx, c}); err != nil {
sqlTx.Rollback()
return err
}
return sqlTx.Commit()
} | |
c164676 | "", err
}
return base64.RawURLEncoding.EncodeToString(data), nil
} | |
c164677 |
if err != nil {
return err
}
return proto.Unmarshal(data, message)
} | |
c164678 | padding
return string(buff[0]%26+'a') + strings.TrimRight(encoding.EncodeToString(buff[1:]), "=")
} | |
c164679 | != nil {
return nil, err
}
return conn, nil
} | |
c164680 |
if err != nil {
return nil, err
}
return conn, nil
} | |
c164681 | !ok {
return fmt.Errorf("unknown storage type %q", store.Type)
}
storageConfig := f()
if len(store.Config) != 0 {
data := []byte(os.ExpandEnv(string(store.Config)))
if err := json.Unmarshal(data, storageConfig); err != nil {
return fmt.Errorf("parse storage config: %v", err)
}
}
*s = Storage{
Type: ... | |
c164682 | err := json.Unmarshal(data, connConfig); err != nil {
return fmt.Errorf("parse connector config: %v", err)
}
}
*c = Connector{
Type: conn.Type,
Name: conn.Name,
ID: conn.ID,
Config: connConfig,
}
return nil
} | |
c164683 | }
return storage.Connector{
ID: c.ID,
Type: c.Type,
Name: c.Name,
Config: data,
}, nil
} | |
c164684 | len(a.Attributes))
for i, attr := range a.Attributes {
s[i] = attr.Name
}
return s
} | |
c164685 | range a.Attributes {
if i != 0 {
buff.WriteString(", ")
}
buff.WriteString(attr.String())
}
return buff.String()
} | |
c164686 | c.Groups,
logger: logger,
}
// By default allow logins from both personal and business/school
// accounts.
if m.tenant == "" {
m.tenant = "common"
}
return &m, nil
} | |
c164687 | dexAPI{
s: s,
logger: logger,
}
} | |
c164688 | actual > upBoundCost {
return fmt.Errorf("given hash cost = %d is above upper bound cost = %d, recommended cost = %d", actual, upBoundCost, recCost)
}
return nil
} | |
c164689 | c.ClientID,
clientSecret: c.ClientSecret,
apiURL: apiURL,
logger: logger,
}
return &b, nil
} | |
c164690 | return len(b.teams) > 0 || groupScope
} | |
c164691 | if len(filteredTeams) == 0 {
return nil, fmt.Errorf("bitbucket: user %q is not in any of the required teams", userLogin)
}
return filteredTeams, nil
} else if groupScope {
return bitbucketTeams, nil
}
return nil, nil
} | |
c164692 | %s: %v", resp.Status, err)
}
return fmt.Errorf("%s: %s", resp.Status, body)
}
if err := json.NewDecoder(resp.Body).Decode(v); err != nil {
return fmt.Errorf("bitbucket: failed to decode response: %v", err)
}
return nil
} | |
c164693 |
clientsByID[client.ID] = client
}
return staticClientsStorage{s, staticClients, clientsByID}
} | |
c164694 | logger.Errorf("Attempting to create StaticPasswords with the same email id: %s", p.Email)
}
passwordsByEmail[lowerEmail] = p
}
return staticPasswordsStorage{s, staticPasswords, passwordsByEmail, logger}
} | |
c164695 |
connectorsByID[c.ID] = c
}
return staticConnectorsStorage{s, staticConnectors, connectorsByID}
} | |
c164696 | TokenURL: tokenURL,
},
Scopes: []string{"r_basicprofile", "r_emailaddress"},
RedirectURL: c.RedirectURI,
},
logger: logger,
}, nil
} | |
c164697 | config %q",
callbackURL, c.oauth2Config.RedirectURL)
}
return c.oauth2Config.AuthCodeURL(state), nil
} | |
c164698 |
client := c.oauth2Config.Client(ctx, token)
profile, err := c.profile(ctx, client)
if err != nil {
return identity, fmt.Errorf("linkedin: get profile: %v", err)
}
identity = connector.Identity{
UserID: profile.ID,
Username: profile.fullname(),
Email: profile.Email,
EmailVerified: tr... | |
c164699 | + " " + p.LastName)
if fname == "" {
return p.Email
}
return fname
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.