Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: CONDSTORE missing MODIFIED response for unchanged items #770

Open
titanism opened this issue Dec 17, 2024 · 0 comments
Open

Bug: CONDSTORE missing MODIFIED response for unchanged items #770

titanism opened this issue Dec 17, 2024 · 0 comments

Comments

@titanism
Copy link
Contributor

See RFC 4551 section here:

https://datatracker.ietf.org/doc/html/rfc4551#section-3.2:~:text=When%20the%20server%20finished%20performing%20the%20operation,all%0A%20%20%20%20%20%20messages%20that%20failed%20the%20UNCHANGESINCE%20test.

When the server finished performing the operation on all the
messages in the message set, it checks for a non-empty list of
messages that failed the UNCHANGESINCE test. If this list is
non-empty, the server MUST return in the tagged response a
MODIFIED response code. The MODIFIED response code includes the
message set (for STORE) or set of UIDs (for UID STORE) of all
messages that failed the UNCHANGESINCE test.

The code below does not support this as far as I can tell:

if (updated) {
getModseq((err, modseq) => {
if (err) {
return cursor.close(() => done(err));
}
if (!update.silent || condstoreEnabled) {
// print updated state of the message
session.writeStream.write(
session.formatResponse('FETCH', message.uid, {
uid: update.isUid ? message.uid : false,
flags: message.flags,
modseq: condstoreEnabled ? modseq : false
})
);
}
if (!flagsupdate.$set) {
flagsupdate.$set = {};
}
flagsupdate.$set.modseq = modseq;
updateEntries.push({
updateOne: {
filter: {
_id: message._id,
// include shard key data as well
mailbox: mailboxData._id,
uid: message.uid,
modseq: {
$lt: modseq
}
},
update: flagsupdate
}
});
notifyEntries.push({
command: 'FETCH',
ignore: session.id,
uid: message.uid,
flags: message.flags,
message: message._id,
modseq,
unseenChange
});
if (updateEntries.length >= consts.BULK_BATCH_SIZE) {
return db.database.collection('messages').bulkWrite(
updateEntries,
{
ordered: false,
writeConcern: 1
},
err => {
updateEntries = [];
if (err) {
return cursor.close(() => done(err));
}
server.notifier.addEntries(mailboxData, notifyEntries, () => {
notifyEntries = [];
server.notifier.fire(session.user.id);
return setImmediate(processNext);
});
}
);
} else {
return setImmediate(processNext);
}
});
} else {
return setImmediate(processNext);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant