Files
wren/test/web/scheduler_integration.wren
T
retoor 62b60cce36 perf: replace string concatenation with list join and add normalized headers map in html, http, jinja, json, markdown modules
Optimize string building in decodeUtf8_, slugify, parseRaw_, processCode_, and processBold_ by accumulating parts in a list and joining once, avoiding repeated string allocation. In HttpResponse constructor, precompute a normalized headers map for O(1) case-insensitive header lookups instead of linear scan. Simplify Json.stringify indent generation using string repetition operator.
2026-01-26 09:59:07 +00:00

42 lines
798 B
JavaScript
Vendored

// retoor <retoor@molodetz.nl>
import "scheduler" for Scheduler
import "timer" for Timer
import "web" for SessionStore
var store = SessionStore.new()
var results = []
var taskCount = 5
for (i in 0...taskCount) {
var index = i
Scheduler.add {
var session = store.create()
session["task"] = index
store.save(session)
results.add({"id": session.id, "index": index})
}
}
System.print(results.count) // expect: 0
Timer.sleep(50)
System.print(results.count) // expect: 5
var uniqueIds = {}
for (r in results) {
uniqueIds[r["id"]] = true
}
System.print(uniqueIds.count) // expect: 5
var hasAll = true
for (i in 0...5) {
var found = false
for (r in results) {
if (r["index"] == i) found = true
}
if (!found) hasAll = false
}
System.print(hasAll) // expect: true