| 59 | log.debug('running leetcode.getProblems'); |
| 60 | let problems = []; |
| 61 | const getCategory = function(category, queue, cb) { |
| 62 | plugin.getCategoryProblems(category, function(e, _problems) { |
| 63 | if (e) { |
| 64 | log.debug(category + ': failed to getProblems: ' + e.msg); |
| 65 | } else { |
| 66 | log.debug(category + ': getProblems got ' + _problems.length + ' problems'); |
| 67 | problems = problems.concat(_problems); |
| 68 | } |
| 69 | return cb(e); |
| 70 | }); |
| 71 | }; |
| 72 | |
| 73 | spin = h.spin('Downloading problems'); |
| 74 | const q = new Queue(config.sys.categories, {}, getCategory); |