Commits

Miki Tebeka  committed 93111d7

Simpler

  • Participants
  • Parent commits 82daec3

Comments (0)

Files changed (2)

File 8-delay/shortie/shortie.go

 	counterKeyName = "counter-key-name"
 	counterKind    = "Counter"
 	urlKind        = "Url"
-	hitWorkerPath  = "/_worker/hit"
 )
 
 // Global counter of urls
 
 func init() {
 	homeTemplate = template.Must(template.New("home").Parse(homeHTML))
-	http.HandleFunc(hitWorkerPath, hitHandler)
 	http.HandleFunc("/", rootHandler)
 }
 
 	return id, nil
 }
 
+// delayedInc is a "delayed" call to incHits.
+var delayedInc = delay.Func("hits", incHits)
+
 /* redirectHandler handles redirects.
 All urls that are not / and worker are assumed to be redirects (short).
 */
 	}, nil)
 }
 
-// delayedInc is a "delayed" call to incHits.
-var delayedInc = delay.Func("hits", incHits)
-
-// hitHandler is handler for updating hits task.
-func hitHandler(w http.ResponseWriter, r *http.Request) {
-	ctx := appengine.NewContext(r)
-	path := r.FormValue("path")
-	if len(path) == 0 {
-		ctx.Errorf("Empty value for hit handler")
-		return
-	}
-	incHits(ctx, path)
-}

File speaker-notes.txt

 shortie.go
     - redirectHandler
 
+8-delay
+-------
+shortie.go
+    - delayedInc
+