From 0d68d0c5fc45dd9a88cd5c2e119e06c432471e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksa=20Siri=C5=A1ki?= <31509435+aleksasiriski@users.noreply.github.com> Date: Thu, 11 Apr 2024 17:34:56 +0200 Subject: [PATCH 1/3] feat: added preferred timeout and hard timeout applied to all engines --- src/config/defaults.go | 48 ++++++++++++++++++++++++++++-------------- src/config/load.go | 26 ++++++++++++----------- src/config/structs.go | 26 ++++++++++++----------- src/main.go | 3 ++- src/search/perform.go | 45 ++++++++++++++++++++++++++++++++++++++- 5 files changed, 106 insertions(+), 42 deletions(-) diff --git a/src/config/defaults.go b/src/config/defaults.go index 80ad8039..53c3763f 100644 --- a/src/config/defaults.go +++ b/src/config/defaults.go @@ -177,64 +177,80 @@ func New() Config { Engines: NewGeneral(), Ranking: NewRanking(), Timings: Timings{ - Timeout: 1000 * time.Millisecond, - PageTimeout: 1000 * time.Millisecond, + PreferredTimeout: 1 * time.Second, + AdditionalTimeout: 100 * time.Millisecond, + Timeout: 3 * time.Second, + PageTimeout: 1 * time.Second, }, }, category.IMAGES: { Engines: NewImage(), Ranking: NewRanking(), Timings: Timings{ - Timeout: 1500 * time.Millisecond, - PageTimeout: 1500 * time.Millisecond, + PreferredTimeout: 1 * time.Second, + AdditionalTimeout: 100 * time.Millisecond, + Timeout: 3 * time.Second, + PageTimeout: 1 * time.Second, }, }, category.INFO: { Engines: NewInfo(), Ranking: NewRanking(), Timings: Timings{ - Timeout: 1000 * time.Millisecond, - PageTimeout: 1000 * time.Millisecond, + PreferredTimeout: 1 * time.Second, + AdditionalTimeout: 100 * time.Millisecond, + Timeout: 3 * time.Second, + PageTimeout: 1 * time.Second, }, }, category.SCIENCE: { Engines: NewScience(), Ranking: NewRanking(), Timings: Timings{ - Timeout: 3000 * time.Millisecond, - PageTimeout: 1000 * time.Millisecond, + PreferredTimeout: 2 * time.Second, + AdditionalTimeout: 200 * time.Millisecond, + Timeout: 5 * time.Second, + PageTimeout: 1 * time.Second, }, }, category.NEWS: { Engines: NewAllEnabled(), Ranking: NewRanking(), Timings: Timings{ - Timeout: 1000 * time.Millisecond, - PageTimeout: 1000 * time.Millisecond, + PreferredTimeout: 1 * time.Second, + AdditionalTimeout: 100 * time.Millisecond, + Timeout: 3 * time.Second, + PageTimeout: 1 * time.Second, }, }, category.BLOG: { Engines: NewAllEnabled(), Ranking: NewRanking(), Timings: Timings{ - Timeout: 2500 * time.Millisecond, - PageTimeout: 1000 * time.Millisecond, + PreferredTimeout: 2 * time.Second, + AdditionalTimeout: 200 * time.Millisecond, + Timeout: 5 * time.Second, + PageTimeout: 1 * time.Second, }, }, category.SURF: { Engines: NewAllEnabled(), Ranking: NewRanking(), Timings: Timings{ - Timeout: 2000 * time.Millisecond, - PageTimeout: 1000 * time.Millisecond, + PreferredTimeout: 2 * time.Second, + AdditionalTimeout: 200 * time.Millisecond, + Timeout: 4 * time.Second, + PageTimeout: 1 * time.Second, }, }, category.NEWNEWS: { Engines: NewAllEnabled(), Ranking: NewRanking(), Timings: Timings{ - Timeout: 1000 * time.Millisecond, - PageTimeout: 1000 * time.Millisecond, + PreferredTimeout: 1 * time.Second, + AdditionalTimeout: 100 * time.Millisecond, + Timeout: 3 * time.Second, + PageTimeout: 1 * time.Second, }, }, }, diff --git a/src/config/load.go b/src/config/load.go index eb000e3a..184c271c 100644 --- a/src/config/load.go +++ b/src/config/load.go @@ -76,12 +76,13 @@ func (c *Config) fromReader(rc ReaderConfig) { } } tim := Timings{ - // HardTimeout: time.Duration(val.RTimings.HardTimeout) * time.Millisecond, - Timeout: time.Duration(val.RTimings.Timeout) * time.Millisecond, - PageTimeout: time.Duration(val.RTimings.PageTimeout) * time.Millisecond, - Delay: time.Duration(val.RTimings.Delay) * time.Millisecond, - RandomDelay: time.Duration(val.RTimings.RandomDelay) * time.Millisecond, - Parallelism: val.RTimings.Parallelism, + PreferredTimeout: time.Duration(val.RTimings.PreferredTimeout) * time.Millisecond, + AdditionalTimeout: time.Duration(val.RTimings.AdditionalTimeout) * time.Millisecond, + Timeout: time.Duration(val.RTimings.Timeout) * time.Millisecond, + PageTimeout: time.Duration(val.RTimings.PageTimeout) * time.Millisecond, + Delay: time.Duration(val.RTimings.Delay) * time.Millisecond, + RandomDelay: time.Duration(val.RTimings.RandomDelay) * time.Millisecond, + Parallelism: val.RTimings.Parallelism, } nc.Categories[key] = Category{ Ranking: val.Ranking, @@ -124,12 +125,13 @@ func (c Config) getReader() ReaderConfig { for key, val := range c.Categories { tim := ReaderTimings{ - // HardTimeout: uint(val.Timings.HardTimeout.Milliseconds()), - Timeout: uint(val.Timings.Timeout.Milliseconds()), - PageTimeout: uint(val.Timings.PageTimeout.Milliseconds()), - Delay: uint(val.Timings.Delay.Milliseconds()), - RandomDelay: uint(val.Timings.RandomDelay.Milliseconds()), - Parallelism: val.Timings.Parallelism, + PreferredTimeout: uint(val.Timings.PreferredTimeout.Milliseconds()), + AdditionalTimeout: uint(val.Timings.AdditionalTimeout.Milliseconds()), + Timeout: uint(val.Timings.Timeout.Milliseconds()), + PageTimeout: uint(val.Timings.PageTimeout.Milliseconds()), + Delay: uint(val.Timings.Delay.Milliseconds()), + RandomDelay: uint(val.Timings.RandomDelay.Milliseconds()), + Parallelism: val.Timings.Parallelism, } rc.RCategories[key] = ReaderCategory{ Ranking: val.Ranking, diff --git a/src/config/structs.go b/src/config/structs.go index cfd2d28a..ebdf19a5 100644 --- a/src/config/structs.go +++ b/src/config/structs.go @@ -130,23 +130,25 @@ type ReaderEngine struct { // ReaderTimings is format in which the config is read from the config file // in miliseconds type ReaderTimings struct { - // HardTimeout uint `koanf:"hardTimeout"` - Timeout uint `koanf:"timeout"` - PageTimeout uint `koanf:"pagetimeout"` - Delay uint `koanf:"delay"` - RandomDelay uint `koanf:"randomdelay"` - Parallelism int `koanf:"parallelism"` + PreferredTimeout uint `koanf:"preferredtimeout"` + AdditionalTimeout uint `koanf:"additionaltimeout"` + Timeout uint `koanf:"timeout"` + PageTimeout uint `koanf:"pagetimeout"` + Delay uint `koanf:"delay"` + RandomDelay uint `koanf:"randomdelay"` + Parallelism int `koanf:"parallelism"` } // Delegates Timeout, PageTimeout to colly.Collector.SetRequestTimeout(); Note: See https://github.com/gocolly/colly/issues/644 // Delegates Delay, RandomDelay, Parallelism to colly.Collector.Limit() type Timings struct { - // HardTimeout time.Duration - Timeout time.Duration - PageTimeout time.Duration - Delay time.Duration - RandomDelay time.Duration - Parallelism int + PreferredTimeout time.Duration + AdditionalTimeout time.Duration + Timeout time.Duration + PageTimeout time.Duration + Delay time.Duration + RandomDelay time.Duration + Parallelism int } // ReaderCategory is format in which the config is read from the config file diff --git a/src/main.go b/src/main.go index 77315bf4..136bcada 100644 --- a/src/main.go +++ b/src/main.go @@ -19,7 +19,8 @@ func main() { mainTimer := time.Now() // setup signal interrupt (CTRL+C) - ctx, _ := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGINT, syscall.SIGTERM) + ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGINT, syscall.SIGTERM) + defer cancel() // parse cli arguments cliFlags := cli.Setup() diff --git a/src/search/perform.go b/src/search/perform.go index f0a7681c..96d4a761 100644 --- a/src/search/perform.go +++ b/src/search/perform.go @@ -83,6 +83,10 @@ func runEngines(engs []engines.Name, query string, options engines.Options, sett var wg sync.WaitGroup engineStarter := NewEngineStarter() + start := time.Now() + ctx, cancelCtx := context.WithTimeout(context.Background(), timings.PreferredTimeout) + ctxHard, cancelCtxHard := context.WithTimeout(context.Background(), timings.Timeout) + for _, eng := range engs { wg.Add(1) go func() { @@ -99,6 +103,45 @@ func runEngines(engs []engines.Name, query string, options engines.Options, sett }() } - wg.Wait() + waitCh := make(chan struct{}) + go func() { + wg.Wait() + waitCh <- struct{}{} + }() + +Outer: + for { + select { + case <-ctx.Done(): + log.Debug(). + Dur("duration", time.Since(start)). + Msg("Timeout reached while waiting for engines") + + // if there are not enough results, switch to additional timeout and wait again + // otherwise break the loop + if len(relay.ResultMap) < 30 { + cancelCtx() // cancel the current context before creating a new one to prevent context leak + ctx, cancelCtx = context.WithTimeout(context.Background(), timings.AdditionalTimeout) + } else { + break Outer + } + + case <-ctxHard.Done(): + log.Debug(). + Dur("duration", time.Since(start)). + Msg("Hard timeout reached while waiting for engines") + + case <-waitCh: + log.Debug(). + Dur("duration", time.Since(start)). + Msg("All engines finished") + break Outer + } + } + + // cancel the current contexts to prevent context leak + cancelCtx() + cancelCtxHard() + return relay.ResultMap } From ae3df11de8c70551cbca5ea318d01bd79709fcd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksa=20Siri=C5=A1ki?= <31509435+aleksasiriski@users.noreply.github.com> Date: Thu, 11 Apr 2024 18:02:32 +0200 Subject: [PATCH 2/3] fix!: comments for clarity and config BREAKING CHANGE: removed duplicate categories --- src/config/defaults.go | 82 +++++++++++++-------------------- src/config/load.go | 32 +++++++------ src/config/structs.go | 35 ++++++++------ src/search/category/category.go | 12 ++--- src/search/category/name.go | 5 +- src/search/perform.go | 16 ++++++- 6 files changed, 89 insertions(+), 93 deletions(-) diff --git a/src/config/defaults.go b/src/config/defaults.go index 53c3763f..68b111f7 100644 --- a/src/config/defaults.go +++ b/src/config/defaults.go @@ -177,80 +177,60 @@ func New() Config { Engines: NewGeneral(), Ranking: NewRanking(), Timings: Timings{ - PreferredTimeout: 1 * time.Second, - AdditionalTimeout: 100 * time.Millisecond, - Timeout: 3 * time.Second, - PageTimeout: 1 * time.Second, + PreferredTimeout: 1 * time.Second, + PreferredTimeoutResults: 30, + AdditionalTimeout: 50 * time.Millisecond, + HardTimeout: 3 * time.Second, + Timeout: 3 * time.Second, + PageTimeout: 1 * time.Second, }, }, category.IMAGES: { Engines: NewImage(), Ranking: NewRanking(), Timings: Timings{ - PreferredTimeout: 1 * time.Second, - AdditionalTimeout: 100 * time.Millisecond, - Timeout: 3 * time.Second, - PageTimeout: 1 * time.Second, + PreferredTimeout: 1 * time.Second, + PreferredTimeoutResults: 40, + AdditionalTimeout: 100 * time.Millisecond, + HardTimeout: 2 * time.Second, + Timeout: 2 * time.Second, + PageTimeout: 1 * time.Second, }, }, category.INFO: { Engines: NewInfo(), Ranking: NewRanking(), Timings: Timings{ - PreferredTimeout: 1 * time.Second, - AdditionalTimeout: 100 * time.Millisecond, - Timeout: 3 * time.Second, - PageTimeout: 1 * time.Second, + PreferredTimeout: 1 * time.Second, + PreferredTimeoutResults: 20, + AdditionalTimeout: 50 * time.Millisecond, + HardTimeout: 2 * time.Second, + Timeout: 2 * time.Second, + PageTimeout: 1 * time.Second, }, }, category.SCIENCE: { Engines: NewScience(), Ranking: NewRanking(), Timings: Timings{ - PreferredTimeout: 2 * time.Second, - AdditionalTimeout: 200 * time.Millisecond, - Timeout: 5 * time.Second, - PageTimeout: 1 * time.Second, + PreferredTimeout: 2 * time.Second, + PreferredTimeoutResults: 40, + AdditionalTimeout: 200 * time.Millisecond, + HardTimeout: 5 * time.Second, + Timeout: 5 * time.Second, + PageTimeout: 1 * time.Second, }, }, - category.NEWS: { + category.ALL: { Engines: NewAllEnabled(), Ranking: NewRanking(), Timings: Timings{ - PreferredTimeout: 1 * time.Second, - AdditionalTimeout: 100 * time.Millisecond, - Timeout: 3 * time.Second, - PageTimeout: 1 * time.Second, - }, - }, - category.BLOG: { - Engines: NewAllEnabled(), - Ranking: NewRanking(), - Timings: Timings{ - PreferredTimeout: 2 * time.Second, - AdditionalTimeout: 200 * time.Millisecond, - Timeout: 5 * time.Second, - PageTimeout: 1 * time.Second, - }, - }, - category.SURF: { - Engines: NewAllEnabled(), - Ranking: NewRanking(), - Timings: Timings{ - PreferredTimeout: 2 * time.Second, - AdditionalTimeout: 200 * time.Millisecond, - Timeout: 4 * time.Second, - PageTimeout: 1 * time.Second, - }, - }, - category.NEWNEWS: { - Engines: NewAllEnabled(), - Ranking: NewRanking(), - Timings: Timings{ - PreferredTimeout: 1 * time.Second, - AdditionalTimeout: 100 * time.Millisecond, - Timeout: 3 * time.Second, - PageTimeout: 1 * time.Second, + PreferredTimeout: 2 * time.Second, + PreferredTimeoutResults: 50, + AdditionalTimeout: 150 * time.Millisecond, + HardTimeout: 5 * time.Second, + Timeout: 5 * time.Second, + PageTimeout: 1 * time.Second, }, }, }, diff --git a/src/config/load.go b/src/config/load.go index 184c271c..8bea0a71 100644 --- a/src/config/load.go +++ b/src/config/load.go @@ -76,13 +76,15 @@ func (c *Config) fromReader(rc ReaderConfig) { } } tim := Timings{ - PreferredTimeout: time.Duration(val.RTimings.PreferredTimeout) * time.Millisecond, - AdditionalTimeout: time.Duration(val.RTimings.AdditionalTimeout) * time.Millisecond, - Timeout: time.Duration(val.RTimings.Timeout) * time.Millisecond, - PageTimeout: time.Duration(val.RTimings.PageTimeout) * time.Millisecond, - Delay: time.Duration(val.RTimings.Delay) * time.Millisecond, - RandomDelay: time.Duration(val.RTimings.RandomDelay) * time.Millisecond, - Parallelism: val.RTimings.Parallelism, + PreferredTimeout: time.Duration(val.RTimings.PreferredTimeout) * time.Millisecond, + PreferredTimeoutResults: val.RTimings.PreferredTimeoutResults, + AdditionalTimeout: time.Duration(val.RTimings.AdditionalTimeout) * time.Millisecond, + HardTimeout: time.Duration(val.RTimings.HardTimeout) * time.Millisecond, + Timeout: time.Duration(val.RTimings.Timeout) * time.Millisecond, + PageTimeout: time.Duration(val.RTimings.PageTimeout) * time.Millisecond, + Delay: time.Duration(val.RTimings.Delay) * time.Millisecond, + RandomDelay: time.Duration(val.RTimings.RandomDelay) * time.Millisecond, + Parallelism: val.RTimings.Parallelism, } nc.Categories[key] = Category{ Ranking: val.Ranking, @@ -125,13 +127,15 @@ func (c Config) getReader() ReaderConfig { for key, val := range c.Categories { tim := ReaderTimings{ - PreferredTimeout: uint(val.Timings.PreferredTimeout.Milliseconds()), - AdditionalTimeout: uint(val.Timings.AdditionalTimeout.Milliseconds()), - Timeout: uint(val.Timings.Timeout.Milliseconds()), - PageTimeout: uint(val.Timings.PageTimeout.Milliseconds()), - Delay: uint(val.Timings.Delay.Milliseconds()), - RandomDelay: uint(val.Timings.RandomDelay.Milliseconds()), - Parallelism: val.Timings.Parallelism, + PreferredTimeout: uint(val.Timings.PreferredTimeout.Milliseconds()), + PreferredTimeoutResults: val.Timings.PreferredTimeoutResults, + AdditionalTimeout: uint(val.Timings.AdditionalTimeout.Milliseconds()), + HardTimeout: uint(val.Timings.HardTimeout.Milliseconds()), + Timeout: uint(val.Timings.Timeout.Milliseconds()), + PageTimeout: uint(val.Timings.PageTimeout.Milliseconds()), + Delay: uint(val.Timings.Delay.Milliseconds()), + RandomDelay: uint(val.Timings.RandomDelay.Milliseconds()), + Parallelism: val.Timings.Parallelism, } rc.RCategories[key] = ReaderCategory{ Ranking: val.Ranking, diff --git a/src/config/structs.go b/src/config/structs.go index ebdf19a5..0dd87d35 100644 --- a/src/config/structs.go +++ b/src/config/structs.go @@ -130,25 +130,34 @@ type ReaderEngine struct { // ReaderTimings is format in which the config is read from the config file // in miliseconds type ReaderTimings struct { - PreferredTimeout uint `koanf:"preferredtimeout"` - AdditionalTimeout uint `koanf:"additionaltimeout"` - Timeout uint `koanf:"timeout"` - PageTimeout uint `koanf:"pagetimeout"` - Delay uint `koanf:"delay"` - RandomDelay uint `koanf:"randomdelay"` - Parallelism int `koanf:"parallelism"` + PreferredTimeout uint `koanf:"preferredtimeout"` + PreferredTimeoutResults int `koanf:"preferredtimeoutresults"` + AdditionalTimeout uint `koanf:"additionaltimeout"` + HardTimeout uint `koanf:"hardtimeout"` + Timeout uint `koanf:"timeout"` + PageTimeout uint `koanf:"pagetimeout"` + Delay uint `koanf:"delay"` + RandomDelay uint `koanf:"randomdelay"` + Parallelism int `koanf:"parallelism"` } // Delegates Timeout, PageTimeout to colly.Collector.SetRequestTimeout(); Note: See https://github.com/gocolly/colly/issues/644 // Delegates Delay, RandomDelay, Parallelism to colly.Collector.Limit() type Timings struct { - PreferredTimeout time.Duration + // preferred timeout if enough results are found + PreferredTimeout time.Duration + // number of results which if not met will trigger the additional timeout + PreferredTimeoutResults int + // additional timeout if not enough results are found (delay after which the number of results is checked) AdditionalTimeout time.Duration - Timeout time.Duration - PageTimeout time.Duration - Delay time.Duration - RandomDelay time.Duration - Parallelism int + // hard timeout after which the search is forcefully stopped + HardTimeout time.Duration + // colly settings + Timeout time.Duration + PageTimeout time.Duration + Delay time.Duration + RandomDelay time.Duration + Parallelism int } // ReaderCategory is format in which the config is read from the config file diff --git a/src/search/category/category.go b/src/search/category/category.go index 59b4d51c..d86b6296 100644 --- a/src/search/category/category.go +++ b/src/search/category/category.go @@ -5,19 +5,13 @@ import ( ) var FromString = map[string]Name{ - //main "general": GENERAL, "images": IMAGES, "info": INFO, + "wiki": INFO, "science": SCIENCE, - "news": NEWS, - "blog": BLOG, - "surf": SURF, - "newnews": NEWNEWS, - //alternatives - "wiki": INFO, - "sci": SCIENCE, - "nnews": NEWNEWS, + "sci": SCIENCE, + "all": ALL, } // returns category diff --git a/src/search/category/name.go b/src/search/category/name.go index 36da6c46..b438f750 100644 --- a/src/search/category/name.go +++ b/src/search/category/name.go @@ -9,8 +9,5 @@ const ( IMAGES Name = "images" INFO Name = "info" SCIENCE Name = "science" - NEWS Name = "news" - BLOG Name = "blog" - SURF Name = "surf" - NEWNEWS Name = "newnews" + ALL Name = "all" ) diff --git a/src/search/perform.go b/src/search/perform.go index 96d4a761..56a03cc2 100644 --- a/src/search/perform.go +++ b/src/search/perform.go @@ -66,6 +66,7 @@ func PerformSearch(query string, options engines.Options, settings map[engines.N } func runEngines(engs []engines.Name, query string, options engines.Options, settings map[engines.Name]config.Settings, timings config.Timings, salt string) map[string]*result.Result { + // create engine strings slice for logging engsStrs := make([]string, 0, len(engs)) for _, eng := range engs { engsStrs = append(engsStrs, eng.String()) @@ -76,17 +77,20 @@ func runEngines(engs []engines.Name, query string, options engines.Options, sett Strs("engines", engsStrs). Msg("Enabled engines") + // create a relay to store results relay := bucket.Relay{ ResultMap: make(map[string]*result.Result), } + // create a wait group to wait for all engines to finish var wg sync.WaitGroup engineStarter := NewEngineStarter() start := time.Now() ctx, cancelCtx := context.WithTimeout(context.Background(), timings.PreferredTimeout) - ctxHard, cancelCtxHard := context.WithTimeout(context.Background(), timings.Timeout) + ctxHard, cancelCtxHard := context.WithTimeout(context.Background(), timings.HardTimeout) + // run all engines concurrently for _, eng := range engs { wg.Add(1) go func() { @@ -103,15 +107,20 @@ func runEngines(engs []engines.Name, query string, options engines.Options, sett }() } + // wait for all engines to finish waitCh := make(chan struct{}) go func() { wg.Wait() waitCh <- struct{}{} }() + // break the loop if the preferred timeout is reached and there are enough results + // or if the hard timeout is reached + // or if all engines finished Outer: for { select { + // preferred timeout reached case <-ctx.Done(): log.Debug(). Dur("duration", time.Since(start)). @@ -119,18 +128,21 @@ Outer: // if there are not enough results, switch to additional timeout and wait again // otherwise break the loop - if len(relay.ResultMap) < 30 { + if len(relay.ResultMap) < timings.PreferredTimeoutResults { cancelCtx() // cancel the current context before creating a new one to prevent context leak ctx, cancelCtx = context.WithTimeout(context.Background(), timings.AdditionalTimeout) } else { break Outer } + // hard timeout reached case <-ctxHard.Done(): log.Debug(). Dur("duration", time.Since(start)). Msg("Hard timeout reached while waiting for engines") + break Outer + // all engines finished case <-waitCh: log.Debug(). Dur("duration", time.Since(start)). From 128a85d62fb33ff5c6ade2dd63f3ee7a812c70a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksa=20Siri=C5=A1ki?= <31509435+aleksasiriski@users.noreply.github.com> Date: Thu, 11 Apr 2024 18:05:54 +0200 Subject: [PATCH 3/3] fix: readded surf category which is slower general --- src/config/defaults.go | 12 ++++++------ src/search/category/category.go | 2 +- src/search/category/name.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/config/defaults.go b/src/config/defaults.go index 68b111f7..92ccc7f7 100644 --- a/src/config/defaults.go +++ b/src/config/defaults.go @@ -221,15 +221,15 @@ func New() Config { PageTimeout: 1 * time.Second, }, }, - category.ALL: { - Engines: NewAllEnabled(), + category.SURF: { + Engines: NewGeneral(), Ranking: NewRanking(), Timings: Timings{ PreferredTimeout: 2 * time.Second, - PreferredTimeoutResults: 50, - AdditionalTimeout: 150 * time.Millisecond, - HardTimeout: 5 * time.Second, - Timeout: 5 * time.Second, + PreferredTimeoutResults: 60, + AdditionalTimeout: 100 * time.Millisecond, + HardTimeout: 4 * time.Second, + Timeout: 4 * time.Second, PageTimeout: 1 * time.Second, }, }, diff --git a/src/search/category/category.go b/src/search/category/category.go index d86b6296..9ab3261f 100644 --- a/src/search/category/category.go +++ b/src/search/category/category.go @@ -11,7 +11,7 @@ var FromString = map[string]Name{ "wiki": INFO, "science": SCIENCE, "sci": SCIENCE, - "all": ALL, + "surf": SURF, } // returns category diff --git a/src/search/category/name.go b/src/search/category/name.go index b438f750..3b992e1b 100644 --- a/src/search/category/name.go +++ b/src/search/category/name.go @@ -9,5 +9,5 @@ const ( IMAGES Name = "images" INFO Name = "info" SCIENCE Name = "science" - ALL Name = "all" + SURF Name = "surf" )