======= PINGING =======
190089
function attemptPing (db, job, webhookOptions) {
  if (!(typeof webhookOptions === 'object')) {
    throw new Error('No webhook is configured.')
  }

  return webhook.ping(job, webhookOptions)
    .then(response => {
      return _logPing(db, job.id, response)
        .then(function () {
          return response
        })
    })
}
254012
protected void tick ()
    {
        // if we're not connected, skip it
        if (_comm == null) {
            return;
        }

        long now = RunAnywhere.currentTimeMillis();
        if (_dcalc != null) {
            // if our current calculator is done, clear it out
            if (_dcalc.isDone()) {
                if (debugLogMessages()) {
                    log.info("Time offset from server: " + _serverDelta + "ms.");
                }
                _dcalc = null;
            } else if (_dcalc.shouldSendPing()) {
                // otherwise, send another ping
                PingRequest req = new PingRequest();
                _comm.postMessage(req);
                _dcalc.sentPing(req);
            }

        } else if (now - _comm.getLastWrite() > PingRequest.PING_INTERVAL) {
            // if we haven't sent anything over the network in a while, we ping the server to let
            // it know that we're still alive
            _comm.postMessage(new PingRequest());

        } else if (now - _lastSync > CLOCK_SYNC_INTERVAL) {
            // resync our clock with the server
            establishClockDelta(now);
        }
    }
364621
public static void ping(String driver, String url, String user, String password) {
		try {
			Class.forName(driver);
			Connection connection = DriverManager.getConnection(url, user, password);
			connection.close();
		} catch (Exception e) {
			JKExceptionUtil.handle(e);
		}
	}
363343
public function ping()
    {
        try {
            $this->connect();
            $this->pdo->query('select 1')->fetchColumn();
        } catch (\PDOException $e) {
            if (strpos($e->getMessage(), 'server has gone away') !== false) {
                return false;
            }
        }

        return true;
    }
243956
def ping(self, message=None):
        '''
        '''
        return self.write(self.parser.ping(message), encode=False)
830768
def _ping(self) -> bool:
        """"""
        assert self.socket is not None
        resp = None
        try:
            self.socket.sendall(b"PINGPING")
            resp = self.socket.recv(8)
        except Exception:
            pass
        return resp == b"PONGPONG"
18924
function monitor(interval, timeoutCb, pingTimeout) {
  pingTimeout = pingTimeout || interval;
  let currentTimeout;
  let currentInterval;
  let closed = false;

  const onTimeoutExpired = () => {
    if (closed) return;
    closed = true;

    clearTimeout(currentTimeout);
    clearInterval(currentInterval);
    timeoutCb();
  };


  const ping = () => {
    this.ping(undefined, undefined, true);

    if (currentTimeout) return;
    currentTimeout = setTimeout(onTimeoutExpired, pingTimeout);
  };

  this.on('pong', () => {
    clearTimeout(currentTimeout);
    currentTimeout = undefined;
  });

  this.on('close', () => onTimeoutExpired());
  this.on('error', () => onTimeoutExpired());
  currentInterval = setInterval(() => ping(), interval);
}
405965
@GET
  @Path ("/ping")
  @Produces (MediaType.TEXT_PLAIN)
  public Response getPing() {
    return Response.ok("pong").build();
  }
1169317
function receive ( str ){
    ping(); // clear/schedule next ping
    var msg = typeof str === 'string' ? JSON.parse( str ) : str;
    b9.emit('rtm.read', msg, replyTo( null ) );
    // acknowledge that a pending message was sent successfully
    if ( msg.reply_to ){
      delete pending[ msg.reply_to ];
    }
    else if ( msg.type != null ){
      b9.emit( msg.type, msg, replyTo( msg.channel ) );
    }
  }
176407
def ping(self, callback=None, **kwargs):
        
        self.client.fetch(
            self.mk_req('', method='HEAD', **kwargs),
            callback = callback
        )
727932
def ping(self):
        
        status, _, body = self._request('GET', self.ping_path())
        return(status is not None) and (bytes_to_str(body) == 'OK')
1296342
@Override
    boolean ping_i(final boolean fwd) {
	boolean all_alive = true;
	final Iterator it = elements.iterator();
	while (it.hasNext() && all_alive) {
	    final GroupElement e = (GroupElement) it.next();
	    if (e instanceof GroupDeviceElement || fwd) {
		all_alive = e.ping_i(fwd) ? all_alive : false;
	    }
	}
	return all_alive;
    }
185088
async def _do_ping(self):
        
        try:
            while True:
                await asyncio.sleep(1)
                if self._ping_count > 10:
                    await self._reconnect()
                else:
                    self._ping_count += 1
                    await ZMQUtils.send(self._socket, Ping())
        except asyncio.CancelledError:
            return
        except KeyboardInterrupt:
            return
1274464
def _process_ping(self):
        
        yield self.send_command(PONG_PROTO)
        if self._flush_queue.empty():
            yield self._flush_pending()
366109
@Benchmark
  public void pingPong(AdditionalCounters counters) throws Exception {
    record.set(true);
    // No need to do anything, just sleep here.
    Thread.sleep(1001);
    record.set(false);
  }
630653
private function sendPing()
    {
        $this->timeSincePingReq = time();
        $payload = chr(0xc0).chr(0x00);
        fwrite($this->socket, $payload, 2);

        $this->debugMessage("PING sent");
    }
32210
def ping():
    '''
    
    '''
    try:
        cookie = logon()
        logout(cookie)
    except salt.exceptions.CommandExecutionError:
        return False
    except Exception as err:
        log.debug(err)
        return False
    return True