8000 GitHub - egonelbre/antifreeze: antifreeze is a package that detects goroutines that have been waiting for too long
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

egonelbre/antifreeze

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

antifreeze

antifreeze is a package that detects goroutines that have been waiting for too long.

Warning: this package is alpha and may not work as intended.

You can exclude functions that may block forever with antifreeze.Exclude and antifreeze.ExcludeNamed.

Example program that will panic ~1min after you have made a request to it.

package main

import (
	"fmt"
	"net/http"
	"time"

	"github.com/egonelbre/antifreeze"
)

func init() {
	antifreeze.SetFrozenLimit(1 * time.Minute)
}

var ch = make(chan int)

func runner() {
	antifreeze.Exclude()
	<-ch
}

func main() {
	go runner()
	http.Handle("/", http.HandlerFunc(index))
	http.ListenAndServe(":8000", nil)
}

func index(w http.ResponseWriter, r *http.Request) {
	fmt.Println("R:", r)
	<-ch
}

See godoc for more information.

About

antifreeze is a package that detects goroutines that have been waiting for too long

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0