Merged in feature/splittests (pull request #141)
Always Race and Split Tests * addrace * noraceinfull
This commit is contained in:
@@ -23,7 +23,6 @@ type PDF struct {
|
||||
minDimension int
|
||||
minDPI int
|
||||
pngDPI int
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -36,6 +35,8 @@ const (
|
||||
PNG_DEFAULT_DPI = 72
|
||||
)
|
||||
|
||||
var readMu sync.Mutex
|
||||
|
||||
func NewPDFFromReader(buf io.Reader) (*PDF, error) {
|
||||
seek, err := ReaderToSeeker(buf)
|
||||
if err != nil {
|
||||
@@ -64,8 +65,8 @@ func NewPDF(buf io.ReadSeeker) *PDF {
|
||||
}
|
||||
|
||||
func (s *PDF) read(ctx context.Context) (*model.Context, error) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
readMu.Lock()
|
||||
defer readMu.Unlock()
|
||||
|
||||
_, err := s.pdf.Seek(0, io.SeekStart)
|
||||
if err != nil {
|
||||
@@ -100,6 +101,9 @@ func (s *PDF) GetPage(ctx context.Context, index int) ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
readMu.Lock()
|
||||
defer readMu.Unlock()
|
||||
|
||||
extractedReader, err := api.ExtractPage(pdfCtx, index+1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -45,6 +45,9 @@ tasks:
|
||||
-coverprofile={{.COVERAGE_FILE}} \
|
||||
./...
|
||||
- task: coverage
|
||||
race:
|
||||
cmds:
|
||||
- GOMAXPROCS={{.TEST_PARALLEL}} go test -count=1 -parallel {{.TEST_PARALLEL}} -race ./...
|
||||
perf:
|
||||
vars:
|
||||
NUM_RESULTS: 5
|
||||
|
||||
Reference in New Issue
Block a user