/** * @see GridRegistry#removeNewSessionRequest(RequestHandler) */ public boolean removeNewSessionRequest(RequestHandler request) { boolean wasRemoved = newSessionQueue.removeNewSessionRequest(request); if (wasRemoved) { seleniumTestSessionsWaiting.dec(); } return wasRemoved; }
private boolean takeRequestHandler(RequestHandler handler) { final TestSession session = proxies.getNewSession(handler.getRequest().getDesiredCapabilities()); final boolean sessionCreated = session != null; if (sessionCreated) { String remoteName = session.getSlot().getProxy().getId(); long timeToAssignProxy = System.currentTimeMillis() - handler.getRequest().getCreationTime(); LOG.info("Test session with internal key {} assigned to remote ({}) after {} seconds ({} ms).", session.getInternalKey(), remoteName, timeToAssignProxy / 1000, timeToAssignProxy); seleniumTestSessionStartLatency.observe(timeToAssignProxy / Collector.MILLISECONDS_PER_SECOND); seleniumTestSessionsWaiting.dec(); activeTestSessions.add(session); handler.bindSession(session); } return sessionCreated; }
/** * Decrement the gauge with no labels by 1. */ public void dec() { dec(1); } /**
@Benchmark @BenchmarkMode({Mode.AverageTime}) @OutputTimeUnit(TimeUnit.NANOSECONDS) public void prometheusSimpleGaugeNoLabelsDecBenchmark() { prometheusSimpleGaugeNoLabels.dec(); }
/** * Decrement the gauge with no labels by 1. */ public void dec() { dec(1); } /**
@Override public void channelUnregistered(ChannelHandlerContext ctx) throws Exception { super.channelUnregistered(ctx); activeConnections.dec(); }
public void closeConnection() { final Guild guild = shardManager.getGuildById(guildId); if (guild == null) { // todo handle if guild no longer exists LOGGER.error("Error getting guild with ID {} from shard manager", guildId); return; } executorService.submit(() -> { lock.lock(); try { boolean dec = guild.getAudioManager().isConnected(); guild.getAudioManager().closeAudioConnection(); if (dec) { audioStreams.dec(); } state.setVoiceConnectionClosed(); } finally { lock.unlock(); } }); } }
private void handleSendGuildLeaveWebhook(Guild guild) { AvaIre.getLogger().info(ConsoleColor.format( "%redLeft guild with an ID of " + guild.getId() + " called: " + guild.getName() + "%reset" )); if (!avaire.areWeReadyYet()) { return; } Metrics.guilds.dec(); Metrics.geoTracker.labels(guild.getRegion().getName()).dec(); TextChannel channel = avaire.getShardManager().getTextChannelById(DiscordConstants.ACTIVITY_LOG_CHANNEL_ID); if (channel == null) { return; } channel.sendMessage( new EmbedBuilder() .setColor(Color.decode("#EF5350")) .setTimestamp(Instant.now()) .addField("Removed", String.format("%s (ID: %s)", guild.getName(), guild.getId() ), false) .build() ).queue(null, RestActionUtil.ignore); }