Skip to content

Commit

Permalink
Support shutdown event (#6)
Browse files Browse the repository at this point in the history
* Support shutdown event

* Update event name and shutdown message
  • Loading branch information
stanleyphu authored Nov 16, 2022
1 parent 6bb052a commit 330d520
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/edge/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
const EVENT_SET_WARRANTS = "set_warrants"
const EVENT_DEL_WARRANTS = "del_warrants"
const EVENT_RESET_WARRANTS = "reset_warrants"
const EVENT_SHUTDOWN = "shutdown"

type ClientConfig struct {
ApiKey string
Expand Down Expand Up @@ -139,6 +140,8 @@ func (client *Client) processEvent(event *sse.Event) {
err = client.processDelWarrants(event)
case EVENT_RESET_WARRANTS:
err = client.initialize()
case EVENT_SHUTDOWN:
log.Fatal("Shutdown event received. Shutting down.")
}

if err != nil {
Expand Down

0 comments on commit 330d520

Please sign in to comment.