Skip to content

Commit

Permalink
add some comments and settings
Browse files Browse the repository at this point in the history
  • Loading branch information
crazybber committed Nov 26, 2020
1 parent 0954e90 commit 500df15
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug run go",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/main.go",
"cwd": "${workspaceFolder}",
"env": {
"GOROOT":"C:/Go",
},
"args": [
]
},
{
"name": "Debug run example Server",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/examples/program/server/main.go",
},
{
"name": "Debug run example Client",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/examples/program/client/main.go",
},
]
}
1 change: 1 addition & 0 deletions app/cache/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (m *memoryCache) String() string {
return "memory"
}

//NewCache return cache
func NewCache(opts ...cache.Option) cache.Cache {
return &memoryCache{
values: make(map[string]interface{}),
Expand Down
1 change: 1 addition & 0 deletions app/client/backoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/gonitro/nitro/util/backoff"
)

//BackoffFunc for retry
type BackoffFunc func(ctx context.Context, req Request, attempts int) (time.Duration, error)

func exponentialBackoff(ctx context.Context, req Request, attempts int) (time.Duration, error) {
Expand Down
8 changes: 8 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"version": "0.1",
"words": [
"pgrpc",
"urfave",
"gonitro"
]
}
2 changes: 2 additions & 0 deletions util/buf/buf.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ func (b *buffer) Close() error {
return nil
}

//New return a buffer pointer
func New(b *bytes.Buffer) *buffer {
if b == nil {
b = bytes.NewBuffer(nil)
}
return &buffer{b}
}

//NewPool return a pool pointer
func NewPool() *pool {
return &pool{
p: sync.Pool{
Expand Down

0 comments on commit 500df15

Please sign in to comment.