Compare commits
No commits in common. "1b876bb78f1f434ec0a76496cf2be9a56064157b" and "4264ca099e420bf6d6d2fa295c17626baecde6d0" have entirely different histories.
1b876bb78f
...
4264ca099e
23
src/index.ts
23
src/index.ts
|
@ -91,7 +91,10 @@ const plugin: Plugin = {
|
|||
api = _api;
|
||||
setup();
|
||||
|
||||
if (api.pluginConfig.bool("store.memory")) {
|
||||
if (
|
||||
api.pluginConfig.bool("storememory") &&
|
||||
!api.pluginConfig.bool("store")
|
||||
) {
|
||||
memStore = new NodeCache();
|
||||
}
|
||||
|
||||
|
@ -108,15 +111,15 @@ const plugin: Plugin = {
|
|||
}
|
||||
let entry = (await getEntry(newEntry.pk)) as SignedRegistryEntry;
|
||||
|
||||
async function setAndRespond(entry: SignedRegistryEntry) {
|
||||
async function setAndRespond() {
|
||||
await setEntry(newEntry);
|
||||
sendDirectOrBroadcast(
|
||||
Message.create({
|
||||
type: MessageType.CREATED,
|
||||
pubkey: entry.pk,
|
||||
revision: entry.revision,
|
||||
signature: entry.signature,
|
||||
data: entry.data,
|
||||
pubkey: newEntry.pk,
|
||||
revision: newEntry.revision,
|
||||
signature: newEntry.signature,
|
||||
data: newEntry.data,
|
||||
}),
|
||||
origin
|
||||
);
|
||||
|
@ -124,13 +127,11 @@ const plugin: Plugin = {
|
|||
|
||||
if (entry) {
|
||||
if (newEntry.revision <= entry.revision) {
|
||||
setAndRespond(newEntry);
|
||||
return;
|
||||
setAndRespond();
|
||||
}
|
||||
setAndRespond(entry);
|
||||
return;
|
||||
} else {
|
||||
setAndRespond();
|
||||
}
|
||||
setAndRespond(newEntry);
|
||||
});
|
||||
|
||||
events.on("query", async (query: Query, origin: Buffer) => {
|
||||
|
|
Reference in New Issue