(db-workload-light-recently?)
Arbitrary threshold for a good-time to do more db-intensive interval tasks. if threshold is 10 ops per second, that's 10 * 60 = 600 ops per minute
Arbitrary threshold for a good-time to do more db-intensive interval tasks. if threshold is 10 ops per second, that's 10 * 60 = 600 ops per minute
(get-num-db-ops-in-last-minute)
(get-sql-timestamp-from-utc-zoned-dt utc-zoned-dt)
Assumes that zoned-dt in in UTC timezone, java.sql.Timestamp, which is a sublcass of java.util.Date (https://docs.oracle.com/javase/8/docs/api/java/util/Date.html), is put into db verbatim without timezone info, so numbers need to represent utc time Need to use deprecated constructor, otherwise millisecond constructor will convert it to local time on db entry, which is really stupid. Also need to remember converting to java.util.Date numbers, which is again really stupid
Assumes that zoned-dt in in UTC timezone, java.sql.Timestamp, which is a sublcass of java.util.Date (https://docs.oracle.com/javase/8/docs/api/java/util/Date.html), is put into db verbatim without timezone info, so numbers need to represent utc time Need to use deprecated constructor, otherwise millisecond constructor will convert it to local time on db entry, which is really stupid. Also need to remember converting to java.util.Date numbers, which is again really stupid
(get-sql-timestamp-utc-now)
(inc-db-count-tl tl)
(increment-num-db-ops-in-last-minute)
A running count of db ops made in last minute. Keeps track of it in a vec, which is lready in sorted by time, so just need to go through and prune from beginning to get ops from last minute Can add info about requests if want to, but unneeded for now
A running count of db ops made in last minute. Keeps track of it in a vec, which is lready in sorted by time, so just need to go through and prune from beginning to get ops from last minute Can add info about requests if want to, but unneeded for now
(local-date->sql-date local-date)
(print-db-query-stats log-level-keyword header-str)
For now print directly to logl, can do plain string afterwards if needed, though new-lines may be a bit tricker to format
For now print directly to logl, can do plain string afterwards if needed, though new-lines may be a bit tricker to format
(prune-num-db-ops-in-last-minute vec-atom)
Makes sure that atom doesn't contain more than number of ops in last minute. Doesn't use (filter) as we know it's sorted, so no need to go through all items Pass in atom as this not meant to be accessed by client code as it were.
Makes sure that atom doesn't contain more than number of ops in last minute. Doesn't use (filter) as we know it's sorted, so no need to go through all items Pass in atom as this not meant to be accessed by client code as it were.
(reset-db-query-count-atoms)
(sql-timestamp->local-date sql-timestamp)
(sql-timestamp->zoned-dt sql-timestamp)
Sql timestamps automatically convert datetime value in db (with not timezone info), assumed to be UTC, into a local date time, which is then converted into UTC datetime (ZonedDateTime)
Sql timestamps automatically convert datetime value in db (with not timezone info), assumed to be UTC, into a local date time, which is then converted into UTC datetime (ZonedDateTime)
(zoned-dt->sql-time zoned-date-time)
Must use deprecated constructor, can't use milliseconds constructor as that just converts it to localtime on storage instead of utc, as java.sql.Time is wrapper around timezone-less java.util.Date, really dumb
Must use deprecated constructor, can't use milliseconds constructor as that just converts it to localtime on storage instead of utc, as java.sql.Time is wrapper around timezone-less java.util.Date, really dumb
(zoned-dt->sql-timestamp zoned-dt)
Sql Timestamp is both date and time, assumes zoned-dt is in UTC
Sql Timestamp is both date and time, assumes zoned-dt is in UTC
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close