ivandasch commented on a change in pull request #2:
URL: 
https://github.com/apache/ignite-python-thin-client/pull/2#discussion_r560807678



##########
File path: pyignite/cache.py
##########
@@ -185,10 +214,128 @@ def destroy(self):
         """
         Destroys cache with a given name.
         """
-        return cache_destroy(self._client, self._cache_id)
+        return cache_destroy(self.get_best_node(), self._cache_id)
 
     @status_to_exception(CacheError)
-    def get(self, key, key_hint: object=None) -> Any:
+    def _get_affinity(self, conn: 'Connection') -> Dict:
+        """
+        Queries server for affinity mappings. Retries in case
+        of an intermittent error (most probably “Getting affinity for topology
+        version earlier than affinity is calculated”).
+
+        :param conn: connection to Igneite server,
+        :return: OP_CACHE_PARTITIONS operation result value.
+        """
+        for _ in range(AFFINITY_RETRIES or 1):
+            result = cache_get_node_partitions(conn, self._cache_id)
+            if result.status == 0 and result.value['partition_mapping']:
+                break
+            time.sleep(AFFINITY_DELAY)
+
+        return result
+
+    @select_version

Review comment:
       I strongly believe that this decorator is anti-pattern
   Much more readable and understandable just to put some conditions in 
function.
   
   i.e.
   ```
   if self.get_protocol_version() < (1, 4, 0):
         return self.client.random_node
   ```




----------------------------------------------------------------
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:
[email protected]


Reply via email to