MCPcopy Create free account
hub / github.com/aws-samples/aws-lambda-extensions / processEvents

Function processEvents

cache-extension-demo/main.go:49–71  ·  view source on GitHub ↗

Method to process events

(ctx context.Context)

Source from the content-addressed store, hash-verified

47
48// Method to process events
49func processEvents(ctx context.Context) {
50 for {
51 select {
52 case <-ctx.Done():
53 return
54 default:
55 println(plugins.PrintPrefix, "Waiting for event...")
56 res, err := extensionClient.NextEvent(ctx)
57 if err != nil {
58 println(plugins.PrintPrefix, "Error:", err)
59 println(plugins.PrintPrefix, "Exiting")
60 return
61 }
62
63 // Exit if we receive a SHUTDOWN event
64 if res.EventType == extension.Shutdown {
65 println(plugins.PrintPrefix, "Received SHUTDOWN event")
66 println(plugins.PrintPrefix, "Exiting")
67 return
68 }
69 }
70 }
71}

Callers 1

mainFunction · 0.70

Calls 1

NextEventMethod · 0.45

Tested by

no test coverage detected