Plugin hooks (#1452)

* Refactor session and plugin code
* Add context to job tasks
* Show hooks in plugins page
* Refactor session management
This commit is contained in:
WithoutPants
2021-06-11 17:24:58 +10:00
committed by GitHub
parent dde361f9f3
commit 46bbede9a0
48 changed files with 1289 additions and 338 deletions

28
pkg/utils/context.go Normal file
View File

@@ -0,0 +1,28 @@
package utils
import (
"context"
"time"
)
type valueOnlyContext struct {
context.Context
}
func (valueOnlyContext) Deadline() (deadline time.Time, ok bool) {
return
}
func (valueOnlyContext) Done() <-chan struct{} {
return nil
}
func (valueOnlyContext) Err() error {
return nil
}
func ValueOnlyContext(ctx context.Context) context.Context {
return valueOnlyContext{
ctx,
}
}

View File

@@ -23,7 +23,7 @@ func TestOshashEmpty(t *testing.T) {
func TestOshashCollisions(t *testing.T) {
buf1 := []byte("this is dumb")
buf2 := []byte("dumb is this")
var size = int64(len(buf1))
size := int64(len(buf1))
head := make([]byte, chunkSize)
tail1 := make([]byte, chunkSize)