Conversation
ambroseling
left a comment
There was a problem hiding this comment.
This is all super awesome work as the initial skeleton, I dont know how rough do we want this skeleton to be, I think if we clean this up sooner or later it would make our lives a bit easier down the road. let me know if this is reasonable or not, appreciate the work
| } | ||
|
|
||
| func (a *App) enqueueJob(w http.ResponseWriter, r *http.Request) { | ||
| payload := map[string]interface{}{ |
There was a problem hiding this comment.
I know this is just skeleton but any reason why we are hardcoding the payload? we should hardcode in unit tests fs but definitely not in the actual api
| return | ||
| } | ||
| w.WriteHeader(http.StatusAccepted) | ||
| fmt.Fprint(w, "enqueued") |
There was a problem hiding this comment.
can we return a json body back to client to show the status of like did the job enqueue successfully?
|
|
||
| func (a *App) getJobStatus(w http.ResponseWriter, r *http.Request) { | ||
| id := r.URL.Query().Get("id") | ||
| fmt.Fprintln(w, "job id=", id) |
There was a problem hiding this comment.
should this also return a http response back to client rather than printing
|
|
||
| func (a *App) login(w http.ResponseWriter, r *http.Request) { | ||
| ctx := r.Context() | ||
| val, err := a.redisClient.Get(ctx, "some:key").Result() |
There was a problem hiding this comment.
why are we fetching some hardcoded key from redis?
| } | ||
|
|
||
| func main() { | ||
| app := NewApp("localhost:6379", "AMD") |
There was a problem hiding this comment.
can we use env vars instead of hardcoding this?
| fmt.Fprintf(w, "login page; redis says: %q\n", val) | ||
| } | ||
|
|
||
| func (a *App) refresh(w http.ResponseWriter, r *http.Request) { |
There was a problem hiding this comment.
I'm not sure what is refresh shupposed to do?
| log.Fatalf("shutdown error: %v", err) | ||
| } | ||
|
|
||
| log.Println("all services stopped cleanly") |
There was a problem hiding this comment.
I think for all logging we can stick to log utility for everything and not have fmt Print in some places just to keep it consistent
| redisClient: client, | ||
| scheduler: scheduler, | ||
| supervisor: supervisor, | ||
| httpServer: &http.Server{Addr: ":3000", Handler: mux}, |
|
Overriding here since this is a template, we can address these changes in later PRs |
* Create initial API skeleton * Add supabase-go as a dependency * init scheduler and supervisor * Clean up go.mod * Fix Supervisor Start --------- Co-authored-by: blobcode <lhelme123@gmail.com>
#5