changeset 24:2174218dd521

Add comments
author Lewin Bormann <lbo@spheniscida.de>
date Wed, 02 Dec 2020 21:39:38 +0100
parents 8fc023bbfb97
children ac040131eac8
files src/main.rs
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.rs	Wed Dec 02 21:35:59 2020 +0100
+++ b/src/main.rs	Wed Dec 02 21:39:38 2020 +0100
@@ -369,6 +369,7 @@
         }
 
         // Drain notifications from the database.
+        // Also provide updated rows to the client.
         let notifications = db.notifications();
         let mut iter = notifications.timeout_iter(time::Duration::new(0, TICK_MILLIS * 1_000_000));
         let mut count = 0;
@@ -376,6 +377,8 @@
             let payload = notification.payload;
             unlisten(&db, &payload).ok();
 
+            // One query per listening client as secrets may be different.
+            // These queries use the primary key index returning one row only and will be quite fast.
             for request in clients.remove(&payload).unwrap_or(vec![]) {
                 if let Some((geo, last)) =
                     check_for_new_rows(&db, &payload, &request.secret, &None, &Some(1))