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

Function main

go-example-ipc-extension/main.go:25–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23)
24
25func main() {
26 ctx, cancel := context.WithCancel(context.Background())
27
28 sigs := make(chan os.Signal, 1)
29 signal.Notify(sigs, syscall.SIGTERM, syscall.SIGINT)
30 go func() {
31 s := <-sigs
32 cancel()
33 println(printPrefix, "Received", s)
34 println(printPrefix, "Exiting")
35 }()
36
37 res, err := extensionClient.Register(ctx, extensionName)
38 if err != nil {
39 panic(err)
40 }
41 println(printPrefix, "Register response:", prettyPrint(res))
42
43 port := os.Getenv("EXTENSION_HTTP_PORT")
44 if len(port) == 0 {
45 port = "2772"
46 }
47
48 ipc.Start(port)
49
50 // Will block until shutdown event is received or cancelled via the context.
51 processEvents(ctx)
52}
53
54func processEvents(ctx context.Context) {
55 for {

Callers

nothing calls this directly

Calls 4

prettyPrintFunction · 0.70
processEventsFunction · 0.70
RegisterMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected