summaryrefslogtreecommitdiff
path: root/cleanup.go
blob: 0d7d89c78f463a0b403743984f07bc2189568094 (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() {
	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)
	}

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