api: make deepsource happy
This commit is contained in:
@@ -117,6 +117,10 @@ const formatKeys = (keyData) => {
|
||||
return formatted;
|
||||
}
|
||||
|
||||
const updateKeys = (newKeys) => {
|
||||
keys = formatKeys(newKeys);
|
||||
}
|
||||
|
||||
const loadKeys = async (source) => {
|
||||
let updated;
|
||||
if (source.protocol === 'file:') {
|
||||
@@ -138,10 +142,6 @@ const loadKeys = async (source) => {
|
||||
updateKeys(updated);
|
||||
}
|
||||
|
||||
const updateKeys = (newKeys) => {
|
||||
keys = formatKeys(newKeys);
|
||||
}
|
||||
|
||||
const wrapLoad = (url, initial = false) => {
|
||||
loadKeys(url)
|
||||
.then(() => {
|
||||
|
||||
@@ -15,15 +15,19 @@ export const syncSecrets = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (cluster.isPrimary) {
|
||||
let remaining = Object.values(cluster.workers).length;
|
||||
const handleReady = (worker, m) => {
|
||||
if (m.ready)
|
||||
worker.send({ rateSalt, streamSalt });
|
||||
|
||||
if (!--remaining)
|
||||
resolve();
|
||||
}
|
||||
|
||||
for (const worker of Object.values(cluster.workers)) {
|
||||
worker.once('message', (m) => {
|
||||
if (m.ready)
|
||||
worker.send({ rateSalt, streamSalt });
|
||||
|
||||
if (!--remaining)
|
||||
resolve();
|
||||
});
|
||||
worker.once(
|
||||
'message',
|
||||
(m) => handleReady(worker, m)
|
||||
);
|
||||
}
|
||||
} else if (cluster.isWorker) {
|
||||
if (rateSalt || streamSalt)
|
||||
|
||||
Reference in New Issue
Block a user