mtredisalize: Implemented the http POST of the tracked changes to configured URL.

This commit is contained in:
Sascha L. Teichmann 2014-09-17 10:45:44 +02:00
parent f4c188a87a
commit cf0aec6fa5

View File

@ -3,8 +3,11 @@ package main
import (
"encoding/json"
"log"
"net/http"
"sync"
"bytes"
"bitbucket.org/s_l_teichmann/mtredisalize/common"
)
@ -54,8 +57,11 @@ func (ct *ChangeTracker) FlushChanges(url string) (err error) {
log.Printf("WARN: encode changes to JSON failed: %s", err)
return
}
// TODO: implement http POST
_ = encoded
var buf bytes.Buffer
buf.Write(encoded)
if _, err = http.Post(url, "application/json", &buf); err != nil {
log.Printf("WARN: posting changes to %s failed: %s", url, err)
}
}()
return
}