diff --git a/main.go b/main.go index 42264535aad6274d3e2ba760f0d5f3db234d3837..4ee9d5ed6d7a8dba4aa3b7f0a59087f18aaeaed1 100644 --- a/main.go +++ b/main.go @@ -10,6 +10,7 @@ import ( "fmt" "encoding/base64" "crypto/rand" + "time" ) func writeBody(reader io.ReadCloser, path string) error { @@ -116,6 +117,8 @@ func main() { return } + fmt.Printf("Created task %s at %d\n", image.Id, time.Now().Unix()) + data, err := json.Marshal(image) if err != nil { returnResult(w, Result{ @@ -129,6 +132,8 @@ func main() { pubsub := client.Subscribe(config.ResultChannel) client.RPush(fmt.Sprintf("queue:%s", config.ImageQueue), data) + fmt.Printf("Submitted task %s at %d\n", image.Id, time.Now().Unix()) + waiting := true for waiting { message, err := pubsub.ReceiveMessage() @@ -152,6 +157,8 @@ func main() { return } + fmt.Printf("Returned task %s at %d\n", result.Id, time.Now().Unix()) + if result.Id == image.Id { waiting = false