File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
service/src/main/java/crawlercommons/urlfrontier/service Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 11
11
import crawlercommons .urlfrontier .Urlfrontier .AckMessage .Status ;
12
12
import crawlercommons .urlfrontier .Urlfrontier .BlockQueueParams ;
13
13
import crawlercommons .urlfrontier .Urlfrontier .Boolean ;
14
+ import crawlercommons .urlfrontier .Urlfrontier .CrawlLimitParams ;
14
15
import crawlercommons .urlfrontier .Urlfrontier .Empty ;
15
16
import crawlercommons .urlfrontier .Urlfrontier .GetParams ;
16
17
import crawlercommons .urlfrontier .Urlfrontier .KnownURLItem ;
@@ -870,6 +871,26 @@ public void close() throws IOException {
870
871
}
871
872
}
872
873
874
+ public void setCrawlLimit (CrawlLimitParams params , StreamObserver <Empty > responseObserver ) {
875
+ QueueWithinCrawl searchKey = new QueueWithinCrawl (params .getKey (), params .getCrawlID ());
876
+ synchronized (getQueues ()) {
877
+ QueueInterface qi = getQueues ().get (searchKey );
878
+ if (qi != null ) {
879
+ qi .setCrawlLimit (params .getLimit ());
880
+ } else {
881
+ LOG .error (
882
+ "Queue with key: {} and CrawlId: {} was not found." ,
883
+ searchKey .getQueue (),
884
+ searchKey .getCrawlid ());
885
+ responseObserver .onError (
886
+ new RuntimeException ("CrawlId and Queue combination is not found." ));
887
+ return ;
888
+ }
889
+ }
890
+
891
+ responseObserver .onCompleted ();
892
+ }
893
+
873
894
public abstract void getURLStatus (
874
895
crawlercommons .urlfrontier .Urlfrontier .URLStatusRequest request ,
875
896
io .grpc .stub .StreamObserver <URLItem > responseObserver );
You can’t perform that action at this time.
0 commit comments