Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
B backbone-adapter-python
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 9
    • Issues 9
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Metrics
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Package Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Communications Backbone System
  • backbone-adapter-python
  • Issues
  • #26

Closed
Open
Created Feb 17, 2025 by Owain Jones@owanesOwner

Set default timeout for HTTP requests

Calls for requests.get etc could do with a timeout= arg set. Requests doesn't set one by default so it allows for HTTP requests to hang for an infinitely long time in some cases - the web server has to drop the TCP connection. We're lucky that nginx on nucleus.noc.ac.uk is doing that (when the CB API doesn't respond with any HTTP headers) but with a different configuration it wouldn't. This will surface bugs where the CB appears not to be receiving messages and there are no errors logged about it.

I think a sensible default is 30 seconds but make this configurable e.g. in the adapter initialization args.

Desired behaviour / for testing:

  • Start up a local comms backbone
  • Connect python adapter to it
  • docker pause <comms backbone API container name>
  • Do adapter.poll()
  • The poll() call should raise an Exception after seconds

Bonus points: Wrap the comms backbone API requests in a requests.Session with the timeout set on the session. The session will also do things like connection pooling which means frequent polling of the backbone will re-use the same TCP connection (bit more efficient).

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking