{"id":42138214,"url":"https://github.com/gogama/aws-sdk-go-flextime","last_synced_at":"2026-02-05T16:03:12.599Z","repository":{"id":134785016,"uuid":"328254511","full_name":"gogama/aws-sdk-go-flextime","owner":"gogama","description":"Adaptive timeouts for AWS SDK for Go","archived":false,"fork":false,"pushed_at":"2026-01-23T22:33:56.000Z","size":45,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-24T11:12:23.546Z","etag":null,"topics":["aws","aws-sdk","go","golang","timeout","timeout-library","timeouts"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gogama.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-09T22:02:13.000Z","updated_at":"2026-01-23T22:32:42.000Z","dependencies_parsed_at":"2023-03-17T07:30:36.638Z","dependency_job_id":null,"html_url":"https://github.com/gogama/aws-sdk-go-flextime","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/gogama/aws-sdk-go-flextime","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gogama%2Faws-sdk-go-flextime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gogama%2Faws-sdk-go-flextime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gogama%2Faws-sdk-go-flextime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gogama%2Faws-sdk-go-flextime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gogama","download_url":"https://codeload.github.com/gogama/aws-sdk-go-flextime/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gogama%2Faws-sdk-go-flextime/sbom","scorecard":{"id":433817,"data":{"date":"2025-08-11","repo":{"name":"github.com/gogama/aws-sdk-go-flextime","commit":"8c4050e32b6713748be7c1f64ff445f00aec8550"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/22 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"16 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2022-0391 / GHSA-6jvc-q2x7-pchv / GHSA-76wf-9vgp-pj7w","Warn: Project is vulnerable to: GO-2022-0635 / GHSA-7f33-f4f5-xwgw","Warn: Project is vulnerable to: GO-2022-0646 / GHSA-f5pg-7wfw-84q9","Warn: Project is vulnerable to: GO-2022-0236 / GHSA-h86h-8ppg-mxmh","Warn: Project is vulnerable to: GO-2021-0238 / GHSA-83g2-8m93-v3w7","Warn: Project is vulnerable to: GO-2022-0288","Warn: Project is vulnerable to: GO-2022-0969 / GHSA-69cg-p879-7622","Warn: Project is vulnerable to: GO-2022-1144 / GHSA-xrjj-mj9h-534m","Warn: Project is vulnerable to: GO-2023-1571 / GHSA-vvpx-j8f3-3w6h","Warn: Project is vulnerable to: GO-2023-1988 / GHSA-2wrh-6pvc-2jm9","Warn: Project is vulnerable to: GO-2023-2102 / GHSA-4374-p667-p6c8","Warn: Project is vulnerable to: GHSA-qppj-fm5r-hxr3","Warn: Project is vulnerable to: GO-2024-2687 / GHSA-4v7x-pqxf-cx7m","Warn: Project is vulnerable to: GO-2024-3333","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T04:06:02.260Z","repository_id":134785016,"created_at":"2025-08-19T04:06:02.260Z","updated_at":"2025-08-19T04:06:02.260Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28782167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T13:55:28.044Z","status":"ssl_error","status_checked_at":"2026-01-26T13:55:26.068Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-sdk","go","golang","timeout","timeout-library","timeouts"],"created_at":"2026-01-26T16:32:12.109Z","updated_at":"2026-01-26T16:32:14.991Z","avatar_url":"https://github.com/gogama.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"flextime - Adaptive timeouts for AWS SDK for Go\n===============================================\n\n[![Build Status](https://travis-ci.org/gogama/aws-sdk-go-flextime.svg)](https://travis-ci.com/gogama/aws-sdk-go-flextime) [![Go Report Card](https://goreportcard.com/badge/github.com/gogama/aws-sdk-go-flextime)](https://goreportcard.com/report/github.com/gogama/aws-sdk-go-flextime) [![PkgGoDev](https://pkg.go.dev/badge/github.com/gogama/aws-sdk-go-flextime)](https://pkg.go.dev/github.com/gogama/aws-sdk-go-flextime)\n\nPackage flextime provides adaptive timeouts when retrying requests to AWS\nservices using the [AWS SDK for Go](https://github.com/aws/aws-sdk-go).\n\nGetting Started\n===============\n\nInstall flextime:\n\n```sh\n$ go get github.com/gogama/aws-sdk-go-flextime\n```\n\nImport the flextime package and install a TimeoutFunc on your AWS SDK service\nclient begin enjoy adaptive timeouts when calling that service:\n\n```go\npackage main\n\nimport (\n\t\"time\"\n\t\n\t\"github.com/aws/aws-sdk-go/aws/session\"\n\t\"github.com/aws/aws-sdk-go/service/dynamodb\"\n\t\"github.com/gogama/aws-sdk-go-flextime/flextime\"\n)\n\nfunc main() {\n\ts := session.Must(session.NewSession())\n\t// Create a DynamoDB client\n\tddb := dynamodb.New(s)\n\t// Set an initial request timeout on the DynamoDB client at 200ms, a first\n\t// retry timeout at 800ms, and all subsequent retry timeouts at 2 seconds.\n\tflextime.OnClient(ddb.Client, flextime.Sequence(200*time.Millisecond, 800*time.Millisecond, 2*time.Second))\n}\n```\n\nIf you have a more general timeout strategy, you can install it on the session,\nso it will be used by all AWS service clients created from that session.\n\n```go\npackage main\n\nimport (\n\t\"time\"\n\n\t\"github.com/aws/aws-sdk-go/aws/request\"\n\t\"github.com/aws/aws-sdk-go/aws/session\"\n\t\"github.com/aws/aws-sdk-go/service/locationservice\"\n\t\"github.com/aws/aws-sdk-go/service/sqs\"\n\t\"github.com/gogama/aws-sdk-go-flextime/flextime\"\n)\n\nfunc timeoutStrategy(r *request.Request, n int) time.Duration {\n\t// Your custom timeout strategy implementation.\n}\n\nfunc main() {\n\ts := session.Must(session.NewSession())\n\tflextime.OnSession(s, timeoutStrategy)\n\tlocClient := locationservice.New(s) // Amazon Location Service client uses custom timeout strategy.\n\tsqsClient := sqs.New(s)             // Simple Queue Service client uses same custom timeout strategy.\n\tdoStuff(locClient, sqsClient)\n}\n```\n\nFor AWS SDK for Go v2, use the v2 package:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"time\"\n\n\t\"github.com/aws/aws-sdk-go-v2/config\"\n\t\"github.com/aws/aws-sdk-go-v2/service/dynamodb\"\n\t\"github.com/gogama/aws-sdk-go-flextime/v2\"\n)\n\nfunc main() {\n\tcfg, err := config.LoadDefaultConfig(context.TODO())\n\tif err != nil {\n\t\t// Handle error\n\t}\n\t// Set timeouts: 200ms initial, 800ms first retry, 2s subsequent retries\n\tflextime.OnConfig(\u0026cfg, flextime.Sequence(200*time.Millisecond, 800*time.Millisecond, 2*time.Second))\n\tddb := dynamodb.NewFromConfig(cfg)\n\t// Use ddb client with adaptive timeouts\n}\n```\n\nYou can also use a custom timeout strategy with v2:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"time\"\n\n\t\"github.com/aws/aws-sdk-go-v2/config\"\n\t\"github.com/aws/aws-sdk-go-v2/service/s3\"\n\t\"github.com/aws/aws-sdk-go-v2/service/sqs\"\n\t\"github.com/gogama/aws-sdk-go-flextime/v2\"\n)\n\nfunc timeoutStrategy(attempt int) time.Duration {\n\t// Your custom timeout strategy implementation.\n\treturn time.Duration(attempt+1) * 500 * time.Millisecond\n}\n\nfunc main() {\n\tcfg, err := config.LoadDefaultConfig(context.TODO())\n\tif err != nil {\n\t\t// Handle error\n\t}\n\tflextime.OnConfig(\u0026cfg, timeoutStrategy)\n\ts3Client := s3.NewFromConfig(cfg)   // S3 client uses custom timeout strategy.\n\tsqsClient := sqs.NewFromConfig(cfg) // SQS client uses same custom timeout strategy.\n\tdoStuff(s3Client, sqsClient)\n}\n```\n\nCheck out [the full API documentation](https://pkg.go.dev/github.com/gogama/aws-sdk-go-flextime).\n\n---\n\nLicense\n=======\n\nThis project is licensed under the terms of the MIT License.\n\n---\n\nFAQ\n===\n\n## What Go versions are supported?\n\nPackage flextime works on Go 1.13 and higher.\n\n## What AWS SDK for Go versions are supported?\n\nPackage flextime works on AWS SDK 1.14.0 and higher.\n\nThe [AWS SDK for Go v2](https://github.com/aws/aws-sdk-go-v2) is supported by flextime/v2.\n\n## Why do I want adaptive timeouts on the AWS SDK for Go?\n\nAWS services are normally pretty fast, but sometimes they do experience \"pockets\nof badness\" where some requests end up taking a long time. Often, simply\ncancelling the request and retrying it can result in a faster service time on\nthe second attempt, giving a better overall experience for your customers\ndownstream.\n\nHowever, a problem arises when the AWS service is experiencing a prolonged period\nof  degraded performance. If you have set a low static timeout, you may experience\nthe worst possible scenario:\n\n- Your initial request times out.\n- All your retries time out.\n- Your pointless retries are contributing to overloading the AWS service, and\n  you may be paying for those cancelled requests despite not getting any service. \n- *Your* service is taking forever to respond to *its* downstream clients, who\n  are themselves by now starting to time out and retry, exponentially growing\n  the retry stormfront!\n\nAdaptive timeouts help you balance the competing concerns by starting with a low\ndefensive timeout to maintain your service performance during a \"pocket of\nbadness\" from the upstream AWS service while transitioning to a higher \"wait\npatiently\" mode if the low timeout strategy isn't producing results.\n\n## How does flextime play with the other HTTP client timeouts?\n\nExcellent question. The AWS SDK for Go relies on the Go standard library HTTP\nclient (`http.Client` from package net/http), and you can configure the standard\nclient within your AWS SDK client. The standard client supports multiple timeouts:\n\n- The field `Client.Timeout` allows global static timeout applicable to all\n  requests made from the client. The default zero value indicates no timeout.\n- The `http.Transport` structure allows global static timeouts to be set on\n  granular components of the HTTP transaction (dial, TLS handshake, expect\n  continue, response headers). Again the default zero value indicates no timeout.\n\nIf you configure the above static timeouts with non-zero values, they will\nconflict with flextime's timeouts, and you may get unexpected results.\nTherefore, it is preferable to leave them with the zero value.\n\n## How does flextime play with context deadlines?\n\nWhen using the AWS SDK for Go's \"WithContext\" methods, you can provide a\n`context.Context` when making AWS SDK requests, and the SDK will respect the\ncontext deadline, if one is set. Such a deadline applies to the entire \"logical\"\nSDK request (including all retries), so it is not at the individual HTTP request\nlevel, and it is not adaptable.\n\nAn AWS SDK client with flextime installed will continue to respect the context\ndeadline as normal. This means you can have an adaptive timeout policy applying\nat the individual HTTP request level *and* a macro timeout applying to the\nentire \"logical\" request.\n\n## What other projects support adaptive timeouts?\n\nPackage [httpx](https://github.com/gogama/httpx) (general purpose reliable HTTP\nclient for Go with retry) supports configurable timeout policies.\n\n---\n\nAcknowledgements\n================\n\nDeveloper happiness on this project was boosted by JetBrains' generous donation\nof an [open source license](https://www.jetbrains.com/opensource/) for their\nlovely GoLand IDE. ❤\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgogama%2Faws-sdk-go-flextime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgogama%2Faws-sdk-go-flextime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgogama%2Faws-sdk-go-flextime/lists"}