mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-24 09:10:17 +01:00
mtredisalize: Implemented the http POST of the tracked changes to configured URL.
This commit is contained in:
parent
f4c188a87a
commit
cf0aec6fa5
@ -3,8 +3,11 @@ package main
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"log"
|
"log"
|
||||||
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"bytes"
|
||||||
|
|
||||||
"bitbucket.org/s_l_teichmann/mtredisalize/common"
|
"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)
|
log.Printf("WARN: encode changes to JSON failed: %s", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// TODO: implement http POST
|
var buf bytes.Buffer
|
||||||
_ = encoded
|
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
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user