~hloeung/ubuntu-repository-cache/install-w3m-for-apache2ctl

« back to all changes in this revision

Viewing changes to files/health_check.py

  • Committer: mergebot at canonical
  • Author(s): "Haw Loeung"
  • Date: 2021-03-02 01:48:16 UTC
  • mfrom: (316.1.3 ubuntu-repository-cache-charm)
  • Revision ID: mergebot@juju-139df4-prod-is-toolbox-0.canonical.com-20210302014816-vmbrjrd7m1rmdqg6
Add socket timeout for sending metrics to influx

Reviewed-on: https://code.launchpad.net/~hloeung/ubuntu-repository-cache/add-send-to-influx-socket-timeout/+merge/398931
Reviewed-by: Paul Collins <paul.collins@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
    port = int(port)
49
49
    try:
50
50
        s = socket.socket()
 
51
        s.settimeout(2)
51
52
        s.connect((host, port))
52
53
        with s.makefile(mode='w') as dest:
53
54
            dest.write(metrics)