try { $mdb->getCollection('crestmails')->save(['killID' => (int) $killID, 'hash' => $hash, 'processed' => false, 'source' => 'api', 'added' => $mdb->now()]); ++$killsAdded; } catch (MongoDuplicateKeyException $ex) { // ignore it *sigh* } } if (!$exists && $debug) { Util::out("Added {$killID} from API"); } } // helpful info for output if needed $info = $mdb->findDoc('information', ['type' => 'characterID', 'id' => $charID], [], ['name' => 1, 'corporationID' => 1]); $corpInfo = $mdb->findDoc('information', ['type' => 'corporationID', 'id' => @$info['corporationID']], [], ['name' => 1]); $apiVerifiedSet = new RedisTtlSortedSet('ttlss:apiVerified', 86400); $apiVerifiedSet->add(time(), $type == 'Corporation' ? @$info['corporationID'] : $charID); if ($newMaxKillID == 0) { $tqApiChars->setTime($row, time() + rand(72000, 86400)); } // If we got new kills tell the log about it if ($killsAdded > 0) { if ($type == 'Corporation') { $name = 'corp ' . @$corpInfo['name']; } else { $name = 'char ' . @$info['name']; } while (strlen("{$killsAdded}") < 3) { $killsAdded = ' ' . $killsAdded; } Util::out("{$killsAdded} kills added by {$name}"); }
public function registerListener($queueID) { $allQueues = new RedisTtlSortedSet('redisQ:allQueues'); $allQueues->add(time(), $queueID); }