Merge branch 'main' of github.com:silverbulletmd/silverbullet

This commit is contained in:
Zef Hemel
2026-07-14 15:38:25 +02:00
3 changed files with 17 additions and 13 deletions
+14 -7
View File
@@ -181,13 +181,20 @@ export class DataStoreMQ {
async poll(queue: string, maxItems: number): Promise<MQMessage[]> {
// Note: this is not happening in a transactional way, so we may get duplicate message delivery
// Retrieve a batch of messages
const messages = await this.ds.luaQuery<MQMessage>(
[...queuedPrefix, queue],
{
limit: maxItems,
},
);
// Retrieve a batch of messages with an early-terminating cursor scan.
// (luaQuery would materialize the ENTIRE queue before applying the
// limit — O(queue length) per poll, quadratic over a full space reindex.)
const messages: MQMessage[] = [];
for await (
const { value } of this.ds.query<MQMessage>({
prefix: [...queuedPrefix, queue],
})
) {
messages.push(value);
if (messages.length >= maxItems) {
break;
}
}
if (messages.length === 0) {
return [];
}
+1
View File
@@ -5,6 +5,7 @@
max-width: 90%;
border-radius: 8px;
overflow: hidden;
box-sizing: border-box;
&::backdrop {
background-color: var(--modal-backdrop-color);
+2 -6
View File
@@ -68,12 +68,8 @@ local function augmentGlobal(localCode)
-- Then approximate specific local tag-based object declarations in queries and add them
-- matches `tags.something`, `index.tag "something"` and `index.tag("something")` patterns only
for m in string.matchRegexAll(localCode, "(?:from|local)\\s+(\\w+)\\s+=\\s*(?:index\\.objects\\s*\"(\\w+)\"|index\\.objects\\s*\\(\"(\\w+)\"\\)|tags\\.(\\w+))") do
local tag
for i, t in ipairs(m) do
if i > 2 and t then
tag = t
end
end
-- m[1] = full match, m[2] = variable name, m[3..5] = tag from each alternative
local tag = m[3] or m[4] or m[5]
-- Do we have a schema for this tag?
local schema = config.get({"tags", tag, "schema"})
if schema then