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 1111import crawlercommons .urlfrontier .Urlfrontier .AckMessage .Status ;
1212import crawlercommons .urlfrontier .Urlfrontier .BlockQueueParams ;
1313import crawlercommons .urlfrontier .Urlfrontier .Boolean ;
14+ import crawlercommons .urlfrontier .Urlfrontier .CrawlLimitParams ;
1415import crawlercommons .urlfrontier .Urlfrontier .Empty ;
1516import crawlercommons .urlfrontier .Urlfrontier .GetParams ;
1617import crawlercommons .urlfrontier .Urlfrontier .KnownURLItem ;
@@ -870,6 +871,26 @@ public void close() throws IOException {
870871 }
871872 }
872873
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+
873894 public abstract void getURLStatus (
874895 crawlercommons .urlfrontier .Urlfrontier .URLStatusRequest request ,
875896 io .grpc .stub .StreamObserver <URLItem > responseObserver );
You can’t perform that action at this time.
0 commit comments