Skip to content

Commit

Permalink
Added chunk mode for dealing with really big file
Browse files Browse the repository at this point in the history
  • Loading branch information
j3ssie committed Aug 10, 2020
1 parent 5b81234 commit 0a26473
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func init() {
RootCmd.PersistentFlags().BoolVar(&options.Debug, "debug", false, "Debug")
// chunk options
RootCmd.PersistentFlags().BoolVar(&options.ChunkRun, "chunk", false, "Enable chunk running against big input")
RootCmd.PersistentFlags().IntVarP(&options.Threads, "threads","t", 1, "Number of Threads")
RootCmd.PersistentFlags().IntVarP(&options.Threads, "threads","t", 1, "Number of Threads (Only used in chunk mode)")
RootCmd.PersistentFlags().IntVar(&options.ChunkSize, "chunk-size", 10000, "Chunk Size")
RootCmd.PersistentFlags().StringVar(&options.ChunkDir, "chunk-dir", "", "Temp Directory to store chunk directory")
RootCmd.PersistentFlags().IntVar(&options.ChunkLimit, "chunk-limit", 500000, "Limit size to trigger chunk run")
Expand Down
4 changes: 2 additions & 2 deletions cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,14 +523,14 @@ func runChunk(command string, urlFiles []string, threads int) {

var wg sync.WaitGroup
p, _ := ants.NewPoolWithFunc(threads, func(i interface{}) {
defer wg.Done()
cmd := i.(string)
ExecutionWithStd(cmd)
wg.Done()
}, ants.WithPreAlloc(true))
defer p.Release()
for _, command := range commands {
wg.Add(1)
p.Invoke(command)
_ = p.Invoke(command)
}
wg.Wait()
}
Expand Down

0 comments on commit 0a26473

Please sign in to comment.