small memory fixes #54

Merged
vtolstov merged 1 commits from memory_fixes into v3 2022-03-27 01:19:48 +03:00
5 changed files with 8 additions and 40 deletions

19
.github/renovate.json vendored
View File

@ -1,19 +0,0 @@
{
"extends": [
"config:base"
],
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
},
{
"groupName": "all deps",
"separateMajorMinor": true,
"groupSlug": "all",
"packagePatterns": [
"*"
]
}
]
}

13
.github/stale.sh vendored
View File

@ -1,13 +0,0 @@
#!/bin/bash -ex
export PATH=$PATH:$(pwd)/bin
export GO111MODULE=on
export GOBIN=$(pwd)/bin
#go get github.com/rvflash/goup@v0.4.1
#goup -v ./...
#go get github.com/psampaz/go-mod-outdated@v0.6.0
go list -u -m -mod=mod -json all | go-mod-outdated -update -direct -ci || true
#go list -u -m -json all | go-mod-outdated -update

View File

@ -20,11 +20,11 @@ var (
// rtr implements router interface // rtr implements router interface
type rtr struct { type rtr struct {
sync.RWMutex sync.RWMutex
running bool
table *table table *table
opts router.Options
exit chan bool exit chan bool
initChan chan bool initChan chan bool
opts router.Options
running bool
} }
// NewRouter creates new router and returns it // NewRouter creates new router and returns it

View File

@ -22,8 +22,8 @@ type table struct {
} }
type route struct { type route struct {
route router.Route
updated time.Time updated time.Time
route router.Route
} }
// newtable creates a new routing table and returns it // newtable creates a new routing table and returns it
@ -129,7 +129,7 @@ func (t *table) Create(r router.Route) error {
} }
// create the route // create the route
t.routes[service][sum] = &route{r, time.Now()} t.routes[service][sum] = &route{updated: time.Now(), route: r}
if t.opts.Logger.V(logger.DebugLevel) { if t.opts.Logger.V(logger.DebugLevel) {
t.opts.Logger.Debugf(t.opts.Context, "Router emitting %s for route: %s", router.Create, r.Address) t.opts.Logger.Debugf(t.opts.Context, "Router emitting %s for route: %s", router.Create, r.Address)
@ -188,7 +188,7 @@ func (t *table) Update(r router.Route) error {
if _, ok := t.routes[service][sum]; !ok { if _, ok := t.routes[service][sum]; !ok {
// update the route // update the route
t.routes[service][sum] = &route{r, time.Now()} t.routes[service][sum] = &route{updated: time.Now(), route: r}
if t.opts.Logger.V(logger.DebugLevel) { if t.opts.Logger.V(logger.DebugLevel) {
t.opts.Logger.Debugf(t.opts.Context, "Router emitting %s for route: %s", router.Update, r.Address) t.opts.Logger.Debugf(t.opts.Context, "Router emitting %s for route: %s", router.Update, r.Address)
@ -198,7 +198,7 @@ func (t *table) Update(r router.Route) error {
} }
// just update the route, but dont emit Update event // just update the route, but dont emit Update event
t.routes[service][sum] = &route{r, time.Now()} t.routes[service][sum] = &route{updated: time.Now(), route: r}
return nil return nil
} }

View File

@ -9,10 +9,10 @@ import (
// tableWatcher implements routing table Watcher // tableWatcher implements routing table Watcher
type tableWatcher struct { type tableWatcher struct {
sync.RWMutex sync.RWMutex
id string
opts router.WatchOptions
resChan chan *router.Event resChan chan *router.Event
done chan struct{} done chan struct{}
id string
opts router.WatchOptions
} }
// Next returns the next noticed action taken on table // Next returns the next noticed action taken on table