112 lines
5.7 KiB
TypeScript
112 lines
5.7 KiB
TypeScript
/* Metro module 5258; source: utils/Queue.tsx; dependencies: [6, 7, 3, 13, 2] */
|
|
import Logger from '../modules/debug/Logger.tsx'; /* Metro dependency 3 */
|
|
import ClassCallCheck from '../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
|
|
function _fun46768(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#46768, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5436:6, offset: 0x011ae566, size: 174 bytes, params: 8, frame: 18
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = Logger;
|
|
value = new value('Queue');
|
|
value = _fun46769();
|
|
(FileImportTrackerModule).fileFinishedImporting('utils/Queue.tsx');
|
|
exports.default = value;
|
|
function _fun46769() { // fn#46769, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5436:144, offset: 0x011ae614, size: 124 bytes, params: 1, frame: 15
|
|
return CreateClass(Queue, [{key: 'enqueue', value: function(a0, a1, a2) {
|
|
this.queue.push({message: a0, success: a1, logId: a2});
|
|
this._drainIfNecessary();
|
|
}}, {key: 'length', get: function() {
|
|
return this.queue.length;
|
|
}}, {key: '_drainIfNecessary', value: value_46773}, {key: 'clear', value: function() {
|
|
this.queue.clear();
|
|
global.clearTimeout(this.timeout);
|
|
this.timeout = null;
|
|
this.draining = false;
|
|
}}]);
|
|
function Queue() { // fn#46770, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5436:165, offset: 0x011ae690, size: 125 bytes, params: 1, frame: 16
|
|
let value = a0;
|
|
const value2 = a1;
|
|
const r4 = value !== undefined ? value : env1_4;
|
|
const r3 = value2 !== undefined ? value2 : 100;
|
|
value = environment.__proto__;
|
|
env1_2(this, Queue);
|
|
this.logger = r4;
|
|
this.defaultRetryAfter = r3;
|
|
value = importDefault(13) /* metro dependency 13 */;
|
|
value = new value();
|
|
this.queue = value;
|
|
this.timeout = null;
|
|
this.draining = false;
|
|
}
|
|
|
|
function value_46773() { // fn#46773, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5436:504, offset: 0x011ae757, size: 191 bytes, params: 1, frame: 20
|
|
var queue;
|
|
var value;
|
|
var message;
|
|
var success;
|
|
var logId;
|
|
var logger;
|
|
var log;
|
|
if (this.timeout === null) {
|
|
queue = this.queue;
|
|
if (queue.length !== 0) {
|
|
if (this.draining !== true) {
|
|
this.draining = true;
|
|
queue = this.queue;
|
|
value = queue.shift();
|
|
message = value.message;
|
|
success = value.success;
|
|
logId = value.logId;
|
|
logger = this.logger;
|
|
log = logger.log;
|
|
queue = this.queue;
|
|
Reflect.apply(log, logger,
|
|
['Draining message from queue LogId:' + logId + ' QueueLength: ' + queue.length]);
|
|
this.drain(message, _fun46774);
|
|
}
|
|
}
|
|
}
|
|
function _fun46774(a0, a1) { // fn#46774, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5436:764, offset: 0x011ae816, size: 269 bytes, params: 3, frame: 26
|
|
var r8;
|
|
var error;
|
|
let binding = env0_0;
|
|
let logger = binding.logger;
|
|
logger.log('Finished draining message from queue LogId:' + logId + ' QueueLength: ' + binding.queue.length);
|
|
binding.draining = false;
|
|
if (a0 == null) {
|
|
global.setImmediate(_fun46775);
|
|
try {
|
|
success(a1);
|
|
} catch (error) {
|
|
logger = env0_0.logger;
|
|
logger.error('', error);
|
|
}
|
|
} else {
|
|
r8 = a0.retryAfter ?? env0_0.defaultRetryAfter;
|
|
binding = env0_0;
|
|
logger = binding.logger;
|
|
logger.info('Rate limited. Delaying draining of queue for ' + r8 + ' ms. LogId:' + logId + ' QueueLength: ' + binding.queue.length);
|
|
binding.timeout = global.setTimeout(_fun46776, r8);
|
|
}
|
|
function _fun46775() { // fn#46775, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5436:916, offset: 0x011ae923, size: 19 bytes, params: 1, frame: 9
|
|
return env1_0._drainIfNecessary();
|
|
}
|
|
|
|
function _fun46776() { // fn#46776, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5436:1195, offset: 0x011ae936, size: 50 bytes, params: 1, frame: 12
|
|
const binding = env1_0;
|
|
binding.queue.unshift(env1_1);
|
|
binding.timeout = null;
|
|
binding._drainIfNecessary();
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun46768, 5258, [6, 7, 3, 13, 2]) /* metro module 5258, dependencies: [6, 7, 3, 13, 2] */;
|