pnoltes commented on code in PR #583:
URL: https://github.com/apache/celix/pull/583#discussion_r1249643487


##########
bundles/remote_services/discovery_common/src/endpoint_discovery_poller.c:
##########
@@ -290,43 +292,32 @@ celix_status_t 
endpointDiscoveryPoller_poll(endpoint_discovery_poller_t *poller,
        return status;
 }
 
-static void *endpointDiscoveryPoller_performPeriodicPoll(void *data) {
-       endpoint_discovery_poller_t *poller = (endpoint_discovery_poller_t *) 
data;
-
-       useconds_t interval = (useconds_t) (poller->poll_interval * 1000000L);
-
-       while (poller->running) {
-               usleep(interval);
-               celix_status_t status = 
celixThreadMutex_lock(&poller->pollerLock);
+static void endpointDiscoveryPoller_performPeriodicPoll(void *data) {
+    endpoint_discovery_poller_t *poller = (endpoint_discovery_poller_t *) data;
+    celix_status_t status = celixThreadMutex_lock(&poller->pollerLock);
+    if (status != CELIX_SUCCESS) {
+        celix_logHelper_warning(*poller->loghelper, "ENDPOINT_POLLER: failed 
to obtain lock; retrying...");
+    } else {
+        hash_map_iterator_pt iterator = 
hashMapIterator_create(poller->entries);
 
-               if (status != CELIX_SUCCESS) {
-            celix_logHelper_warning(*poller->loghelper, "ENDPOINT_POLLER: 
failed to obtain lock; retrying...");
-               } else {
-                       hash_map_iterator_pt iterator = 
hashMapIterator_create(poller->entries);
+        while (hashMapIterator_hasNext(iterator)) {
+            hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
 
-                       while (hashMapIterator_hasNext(iterator)) {
-                               hash_map_entry_pt entry = 
hashMapIterator_nextEntry(iterator);
+            char *url = hashMapEntry_getKey(entry);
+            array_list_pt currentEndpoints = hashMapEntry_getValue(entry);
 
-                               char *url = hashMapEntry_getKey(entry);
-                               array_list_pt currentEndpoints = 
hashMapEntry_getValue(entry);
+            endpointDiscoveryPoller_poll(poller, url, currentEndpoints);

Review Comment:
   I will also revert the discovery poller back to use a separate thread



-- 
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.

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

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

Reply via email to