Skip to content
Snippets Groups Projects
Commit 65308fa7 authored by Travis Ralston's avatar Travis Ralston
Browse files

Small misc cleanup

parent 10f7d207
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,6 @@ import (
"github.com/turt2live/matrix-media-repo/common/runtime"
"github.com/turt2live/matrix-media-repo/database"
"github.com/turt2live/matrix-media-repo/errcache"
"github.com/turt2live/matrix-media-repo/internal_cache"
"github.com/turt2live/matrix-media-repo/metrics"
"github.com/turt2live/matrix-media-repo/plugins"
"github.com/turt2live/matrix-media-repo/pool"
......@@ -134,10 +133,8 @@ func reloadCacheOnChan(reloadChan chan bool) {
shouldReload := <-reloadChan
if shouldReload {
redislib.Reconnect()
internal_cache.ReplaceInstance()
} else {
redislib.Stop()
internal_cache.Get().Stop()
}
}
}()
......
......@@ -16,7 +16,7 @@ type templates struct {
var instance *templates
var singletonLock = &sync.Once{}
func GetInstance() *templates {
func getInstance() *templates {
if instance == nil {
singletonLock.Do(func() {
instance = &templates{
......@@ -28,7 +28,7 @@ func GetInstance() *templates {
}
func GetTemplate(name string) (*template.Template, error) {
i := GetInstance()
i := getInstance()
if v, ok := i.cached[name]; ok {
return v, nil
}
......
......@@ -6,17 +6,9 @@ import (
"encoding/hex"
)
func GenerateRandomBytes(n int) ([]byte, error) {
b := make([]byte, n)
_, err := rand.Read(b)
if err != nil {
return nil, err
}
return b, nil
}
func GenerateRandomString(nBytes int) (string, error) {
b, err := GenerateRandomBytes(nBytes)
b := make([]byte, nBytes)
_, err := rand.Read(b)
if err != nil {
return "", err
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment