Skip to content

wrong time to call 'TraceBatchFinishFunc' #63

@jimyang112

Description

@jimyang112
ctx, finish := b.tracer.TraceBatch(originalContext, keys)
defer finish(items) // this should be moved

func() {
	defer func() {
		if r := recover(); r != nil {
			panicErr = r
			if b.silent {
				return
			}
			const size = 64 << 10
			buf := make([]byte, size)
			buf = buf[:runtime.Stack(buf, false)]
			log.Printf("Dataloader: Panic received in batch function:: %v\n%s", panicErr, buf)
		}
	}()
	items = b.batchFn(ctx, keys)
}()

// defer finish(items) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions