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

Function main

cache-extension-demo/main.go:20–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18)
19
20func main() {
21 ctx, cancel := context.WithCancel(context.Background())
22
23 sigs := make(chan os.Signal, 1)
24 signal.Notify(sigs, syscall.SIGTERM, syscall.SIGINT)
25 go func() {
26 s := <-sigs
27 cancel()
28 println(plugins.PrintPrefix, "Received", s)
29 println(plugins.PrintPrefix, "Exiting")
30 }()
31
32 res, err := extensionClient.Register(ctx, plugins.ExtensionName)
33 if err != nil {
34 panic(err)
35 }
36 println(plugins.PrintPrefix, "Register response:", plugins.PrettyPrint(res))
37
38 // Initialize all the cache plugins
39 extension.InitCacheExtensions()
40
41 // Start HTTP server
42 ipc.Start("4000")
43
44 // Will block until shutdown event is received or cancelled via the context.
45 processEvents(ctx)
46}
47
48// Method to process events
49func processEvents(ctx context.Context) {

Callers

nothing calls this directly

Calls 3

processEventsFunction · 0.70
RegisterMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected