Text string
}
-type FetchResponse struct {
- Messages []Message
- Time time.Time
-}
-
type StoreRequest struct {
StartTime time.Time
Messages chan<- []Message
messages.Remove(messages.Front())
}
case request := <-store.Get:
- if messages.Back() == nil || request.StartTime.After(messages.Back().Value.(Message).Time) {
+ if messages.Back() == nil || !request.StartTime.Before(messages.Back().Value.(Message).Time) {
waiting.PushBack(request)
} else {
start := messages.Back()
messages_from_store := make(chan []Message, 1)
store.Get <- StoreRequest{since, messages_from_store}
- json_encoded, err := json.Marshal(FetchResponse{<-messages_from_store, time.Now()})
+ json_encoded, err := json.Marshal(<-messages_from_store)
if err != nil {
log.Print("json encode: ", err)
w.WriteHeader(http.StatusInternalServerError)