You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/09/23 05:33:34 UTC

[GitHub] [lucene-solr] atris commented on a change in pull request #1906: SOLR-13528: Implement API Based Config For Rate Limiters

atris commented on a change in pull request #1906:
URL: https://github.com/apache/lucene-solr/pull/1906#discussion_r493207484



##########
File path: solr/core/src/java/org/apache/solr/handler/ClusterAPI.java
##########
@@ -171,10 +172,30 @@ public void setPlacementPlugin(PayloadObj<Map<String, Object>> obj) {
         // Need to reset to null first otherwise the mappings in placementPluginConfig are added to existing ones
         // in /clusterprops.json rather than replacing them. If removing the config, that's all we do.
         clusterProperties.setClusterProperties(
-                Collections.singletonMap(PlacementPluginConfigImpl.PLACEMENT_PLUGIN_CONFIG_KEY, null));
+            Collections.singletonMap(PlacementPluginConfigImpl.PLACEMENT_PLUGIN_CONFIG_KEY, null));
+        if (!unset) {
+          clusterProperties.setClusterProperties(
+              Collections.singletonMap(PlacementPluginConfigImpl.PLACEMENT_PLUGIN_CONFIG_KEY, placementPluginConfig));
+        }
+
+      } catch (Exception e) {
+        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Error in API", e);
+      }
+    }
+
+    @Command(name = "set-ratelimiters")
+    public void setRateLimiters(PayloadObj<Map<String, Object>> obj) {
+      Map<String, Object> rateLimiterConfig = obj.getDataMap();
+      final boolean unset = rateLimiterConfig.isEmpty();

Review comment:
       I actually prefer {}, seems cleaner




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org