Don't empty subscribers on restart
This commit is contained in:
parent
5fd4d723ca
commit
3c71f8beaf
|
@ -35,6 +35,7 @@ type subscriptionHandler struct {
|
||||||
func (handler *subscriptionHandler) handlePublish(w http.ResponseWriter, r *http.Request) error {
|
func (handler *subscriptionHandler) handlePublish(w http.ResponseWriter, r *http.Request) error {
|
||||||
topic := r.Form.Get("hub.topic")
|
topic := r.Form.Get("hub.topic")
|
||||||
log.Printf("Topic = %s\n", topic)
|
log.Printf("Topic = %s\n", topic)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,8 +167,9 @@ func (handler *subscriptionHandler) save() error {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
handler := &subscriptionHandler{}
|
handler := &subscriptionHandler{}
|
||||||
handler.Subscribers = make(map[string][]Subscriber)
|
if err := handler.load(); err != nil {
|
||||||
handler.load()
|
handler.Subscribers = make(map[string][]Subscriber)
|
||||||
|
}
|
||||||
http.Handle("/", handler)
|
http.Handle("/", handler)
|
||||||
log.Fatal(http.ListenAndServe(":80", nil))
|
log.Fatal(http.ListenAndServe(":80", nil))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user