 ;(sql-1 "select count(id) from table_name " [])
 
 
+
+(def my-pool (mk-pool))
+(every 10000 (fn []
+              (let [sql (str "update coils_realtime_log"
+                            "      set record_status = 'PROCESSING'"
+                            "where "
+                            "      id in ( SELECT "
+                            "                    id"
+                            "              FROM "
+                            "                    coils_realtime_log"
+                            "              WHERE "
+                            "                   record_status='WAIITING' LIMIT 1 ) "
+                    )]
+                     (do
+                        (println "Checking pool!" )
+                        (korma.core/exec-raw [sql []])
+                 ))) my-pool )
+
+
+



(defn make-log-table []
  (let [coils-admin-tables      (korma.core/exec-raw 
                                   [" select * from pg_tables where schemaname='public' and tablename='coils_realtime_log'" []] 
                                   :results)

        coils-admin-table-exists   (pos? (count coils-admin-tables))

  [:use [webapp.framework.server.db-helper]]
  [:use [webapp.framework.server.neo4j-helper]]
  [:use [webapp.framework.server.globals]]
  (use [overtone.at-at])
  )


