Skip to content

Commit

Permalink
resolve #190
Browse files Browse the repository at this point in the history
  • Loading branch information
huahaiy committed Mar 21, 2023
1 parent a30390c commit 40efa91
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## WIP
### Improved
- [Pod] serialize TxReport to regular map. #190
### Fixed
- [Server] migrate old sessions that do not have `:last-active`.

## 0.8.7 (2023-03-21)
### Added
- [Datalog] `datalog-index-cache-limit` function to get/set the limit of Datalog
Expand Down
13 changes: 8 additions & 5 deletions src/datalevin/server.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2081,11 +2081,14 @@
(let [timeout (.-idle-timeout server)
clients (.-clients server)]
(doseq [[client-id session] clients
:let [{:keys [last-active]} session]
:when last-active]
(when (< ^long timeout
(- (System/currentTimeMillis) ^long last-active))
(disconnect-client* server client-id)))))
:let [{:keys [last-active]} session]]
(if last-active
(when (< ^long timeout
(- (System/currentTimeMillis) ^long last-active))
(disconnect-client* server client-id))
;; migrate old sessions that don't have last-active
(update-client server client-id
#(assoc % :last-active (System/currentTimeMillis)))))))

(defn- event-loop
[^Server server]
Expand Down
4 changes: 3 additions & 1 deletion src/pod/huahaiy/datalevin.clj
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@
(swap! (if writing? wdl-conns dl-conns)
assoc conn (atom d :meta (meta c)))))
(throw e)))]
{:datoms-transacted (count (:tx-data rp))}))))
{:tx-data (:tx-data rp)
:tempids (:tempids rp)
:tx-meta (:tx-meta rp)}))))

(defn db [{:keys [::conn] :as cn}]
(when-let [c (get-cn cn)]
Expand Down

0 comments on commit 40efa91

Please sign in to comment.