waveterm/pkg/utilds/versionts.go
Mike Sawka 01a26d59e6
Persistent Terminal Sessions (+ improvements and bug fixes) (#2806)
Lots of updates across all parts of the system to get this working. Big
changes to routing, streaming, connection management, etc.

* Persistent sessions behind a metadata flag for now
* New backlog queue in the router to prevent hanging
* Fix connection Close() issues that caused hangs when network was down
* Fix issue with random routeids (need to be generated fresh each time
the JWT is used and not fixed) so you can run multiple-wsh commands at
once
* Fix issue with domain sockets changing names across wave restarts
(added a symlink mechanism to resolve new names)
* ClientId caching in main server
* Quick reorder queue for input to prevent out of order delivery across
multiple hops
* Fix out-of-order event delivery in router (remove unnecessary go
routine creation)
* Environment testing and fix environment variables for remote jobs (get
from connserver, add to remote job starts)
* Add new ConnServerInit() remote method to call before marking
connection up
* TODO -- remote file transfer needs to be fixed to not create OOM
issues when transferring large files or directories
2026-01-28 13:30:48 -08:00

24 lines
349 B
Go

package utilds
import (
"sync"
"time"
)
type VersionTs struct {
lock sync.Mutex
lastVersion int64
}
func (v *VersionTs) GetVersionTs() int64 {
v.lock.Lock()
defer v.lock.Unlock()
nowMs := time.Now().UnixMilli()
if nowMs <= v.lastVersion {
v.lastVersion++
return v.lastVersion
}
v.lastVersion = nowMs
return v.lastVersion
}