less logging
This commit is contained in:
parent
061218ef73
commit
3775a5e70e
6
main.go
6
main.go
|
@ -75,7 +75,6 @@ func (c *MetadataCache) Delete(o int64) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *MetadataCache) Get(o int64, k string) ([]string, error) {
|
func (c *MetadataCache) Get(o int64, k string) ([]string, error) {
|
||||||
log.Printf("Get %d, %s.\n", o, k)
|
|
||||||
// Check cache for entry
|
// Check cache for entry
|
||||||
c.lock.RLock()
|
c.lock.RLock()
|
||||||
object, ok := c.objects[o]
|
object, ok := c.objects[o]
|
||||||
|
@ -126,7 +125,6 @@ func loadDbEntries(ot string, id int64) map[string]metadataValues {
|
||||||
return entries
|
return entries
|
||||||
}
|
}
|
||||||
query := fmt.Sprintf("select meta_key, meta_value from %s where %s = ?", table, column)
|
query := fmt.Sprintf("select meta_key, meta_value from %s where %s = ?", table, column)
|
||||||
log.Println(query)
|
|
||||||
rows, err := db.Query(query, id)
|
rows, err := db.Query(query, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("db.Query: %s\n", err.Error())
|
log.Printf("db.Query: %s\n", err.Error())
|
||||||
|
@ -199,12 +197,14 @@ func handleConnection(conn net.Conn, UC MetadataCache, PC MetadataCache) {
|
||||||
var m *MetadataCache
|
var m *MetadataCache
|
||||||
reader := bufio.NewReader(conn)
|
reader := bufio.NewReader(conn)
|
||||||
tp := textproto.NewReader(reader)
|
tp := textproto.NewReader(reader)
|
||||||
|
num:=0
|
||||||
for {
|
for {
|
||||||
buf, err := tp.ReadLine()
|
buf, err := tp.ReadLine()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
conn.Close()
|
conn.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
num++
|
||||||
var c cachecommand
|
var c cachecommand
|
||||||
err = json.Unmarshal([]byte(buf), &c)
|
err = json.Unmarshal([]byte(buf), &c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -233,5 +233,5 @@ func handleConnection(conn net.Conn, UC MetadataCache, PC MetadataCache) {
|
||||||
}
|
}
|
||||||
conn.Write([]byte("\n"))
|
conn.Write([]byte("\n"))
|
||||||
}
|
}
|
||||||
|
log.Printf("Ended connection after %d queries", num)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue