|
|
@ -13,11 +13,19 @@ Data.getMetadataRaw = function (Env, channel /* channelName */, _cb) {
|
|
|
|
|
|
|
|
|
|
|
|
var cached = Env.metadata_cache[channel];
|
|
|
|
var cached = Env.metadata_cache[channel];
|
|
|
|
if (HK.isMetadataMessage(cached)) {
|
|
|
|
if (HK.isMetadataMessage(cached)) {
|
|
|
|
|
|
|
|
Env.checkCache(channel);
|
|
|
|
return void cb(void 0, cached);
|
|
|
|
return void cb(void 0, cached);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Env.batchMetadata(channel, cb, function (done) {
|
|
|
|
Env.batchMetadata(channel, cb, function (done) {
|
|
|
|
Env.computeMetadata(channel, done);
|
|
|
|
Env.computeMetadata(channel, function (err, meta) {
|
|
|
|
|
|
|
|
if (!err && HK.isMetadataMessage(meta)) {
|
|
|
|
|
|
|
|
Env.metadata_cache[channel] = meta;
|
|
|
|
|
|
|
|
// clear metadata after a delay if nobody has joined the channel within 30s
|
|
|
|
|
|
|
|
Env.checkCache(channel);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
done(err, meta);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|