 (defn add-client-to-query [query  client-id]
   (let [
         existing-query     (get @cached-queries   query)
-        existing-clients   (get @query           :clients)
+        existing-clients   (get @existing-query  :clients)
         ]
-        (swap! existing-clients assoc client-id
-        )))
+        (swap! existing-clients conj client-id)
+        ))
 
 
 


     (if (get @cached-queries  query-key)
       nil
       (update-query-in-cache  query-key)

       )

     (do-real   :table-name db-table)


      (println (str "    " query))

      (if (not existing-query)
        (swap! cached-queries assoc  query (atom {:clients  (atom #{})})))


      (let [the-query        (get @cached-queries   query)
            ]
        (swap! the-query assoc  :records       result-id-vector)
        (swap! the-query assoc  :count         record-count)
        (swap! the-query assoc  :timestamp    (java.util.Date.))
        ))))

