Created
January 28, 2017 07:17
-
-
Save liondancer/a9bd7b191369791142c2622c9bc5021f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.then( | |
while (minheap.heapList.length) { | |
let heapNode = minheap.popMin(); | |
let currTimestamp = heapNode['ts']; | |
printer.print(heapNode.data); | |
let nextMinTimestamp = minheap.getPeakTimestamp(); | |
while (currTimestamp <= nextMinTimestamp) { | |
logSources[heapNode['source']].popAsync().then(log => { | |
if (log) { | |
let logtime = log.date.getTime(); | |
if (logtime <= nextMinTimestamp) { | |
printer.print(log); | |
currTimestamp = logtime; | |
} else { | |
minheap.insert({ | |
ts: logtime, | |
source: heapNode["source"], | |
data: log | |
}); | |
break; | |
} | |
} | |
}); | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment