@@ -139,13 +139,13 @@ func InitScraper() {
139139 })
140140}
141141
142- func createTask (clientIP , region , taskType string , query map [string ]string ) (tasksQuantityExceeded bool ) {
142+ func createTask (clientIP , region , taskType string , query map [string ]string ) (taskAdded , tasksQuantityExceeded bool ) {
143143 crc32 := crc32 .NewIEEE ()
144144 crc32 .Write ([]byte (strings .Join (append (slices .Sorted (maps .Values (query )), region , taskType ), "" )))
145145 hashString := strconv .Itoa (int (crc32 .Sum32 ()))
146146
147147 if taskQueue .CountQueuedTasksForClient (clientIP ) >= viper .GetInt ("maxtasksperclient" ) {
148- return true
148+ return false , true
149149 }
150150
151151 url := fmt .Sprintf (
@@ -170,17 +170,17 @@ func createTask(clientIP, region, taskType string, query map[string]string) (tas
170170 "taskType" : taskType ,
171171 })
172172
173- taskQueue .AddTask (clientIP , hashString , utils .BuildRequest (url , query ))
174- return false
173+ added := taskQueue .AddTask (clientIP , hashString , utils .BuildRequest (url , query ))
174+ return added , false
175175}
176176
177- func EnqueueAdventurer (clientIP , region , profileTarget string ) (tasksQuantityExceeded bool ) {
177+ func EnqueueAdventurer (clientIP , region , profileTarget string ) (taskAdded , tasksQuantityExceeded bool ) {
178178 return createTask (clientIP , region , "player" , map [string ]string {
179179 "profileTarget" : profileTarget ,
180180 })
181181}
182182
183- func EnqueueAdventurerSearch (clientIP , region , query , searchType string ) (tasksQuantityExceeded bool ) {
183+ func EnqueueAdventurerSearch (clientIP , region , query , searchType string ) (taskAdded , tasksQuantityExceeded bool ) {
184184 return createTask (clientIP , region , "playerSearch" , map [string ]string {
185185 "Page" : "1" ,
186186 "region" : region ,
@@ -189,14 +189,14 @@ func EnqueueAdventurerSearch(clientIP, region, query, searchType string) (tasksQ
189189 })
190190}
191191
192- func EnqueueGuild (clientIP , region , name string ) (tasksQuantityExceeded bool ) {
192+ func EnqueueGuild (clientIP , region , name string ) (taskAdded , tasksQuantityExceeded bool ) {
193193 return createTask (clientIP , region , "guild" , map [string ]string {
194194 "guildName" : name ,
195195 "region" : region ,
196196 })
197197}
198198
199- func EnqueueGuildSearch (clientIP , region , query string ) (tasksQuantityExceeded bool ) {
199+ func EnqueueGuildSearch (clientIP , region , query string ) (taskAdded , tasksQuantityExceeded bool ) {
200200 return createTask (clientIP , region , "guildSearch" , map [string ]string {
201201 "page" : "1" ,
202202 "region" : region ,
0 commit comments