summaryrefslogtreecommitdiff
path: root/cleanup.go
blob: cfe659dc1cc5c5266d3f9a020fb16828ea7d8fc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package main

import (
	"context"
	"log"
	"time"
)

func cleanup() {
	if err := instance.Close(); err != nil {
		log.Printf("error closing instance: %s", err)
	}

	ctx, cancel := context.WithTimeout(context.Background(), time.Second)
	defer cancel()
	if err := server.Shutdown(ctx); err != nil {
		log.Printf("error shutting down web server: %s", err)
	}
}