Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add prefetch time in logic #131

Merged
merged 1 commit into from
Jan 7, 2025
Merged

add prefetch time in logic #131

merged 1 commit into from
Jan 7, 2025

Conversation

peze
Copy link
Contributor

@peze peze commented Dec 24, 2024

No description provided.

import CredentialsProvider from '../credentials_provider'
import { Request, doRequest } from './http'
import Session from './session'
import { parseUTC } from './time'
import { Session, SessionCredentialProvider, SCALE_TIME } from './session'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stale_time

this.roleName = builder.roleName;
this.disableIMDSv1 = builder.disableIMDSv1;
this.readTimeout = builder.readTimeout;
this.connectTimeout = builder.connectTimeout;
this.checker = this.checkCredentialsUpdateAynchronously();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkCredentialsUpdateAsynchronously

return setTimeout(async () => {
await this.getCredentials();
this.checker = this.checkCredentialsUpdateAynchronously();
console.log(this.checker);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log去掉

checkCredentialsUpdateAynchronously(): NodeJS.Timeout {
return setTimeout(async () => {
await this.getCredentials();
this.checker = this.checkCredentialsUpdateAynchronously();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

失败后会打断

getProviderName(): string {
return 'ram_role_arn';
return `ram_role_arn/${this.credentialsProvider.getProviderName()}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种方式没有记录上上个Provider链路,仅记录了一层

this.scaleTimestamp = now;
}
// 已过期,看缓存,缓存若大于15分钟,返回缓存,若小于15分钟,则根据策略判断是立刻重试还是稍后重试
if (now < this.scaleTimestamp) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种方式没有区分缓存还是这次请求拿到的,this.scaleTimestamp已修改

@peze peze force-pushed the prefetch-upgrade branch 2 times, most recently from 94ba310 to 6f08be7 Compare January 1, 2025 08:59
@codecov-commenter
Copy link

codecov-commenter commented Jan 1, 2025

Codecov Report

Attention: Patch coverage is 91.17647% with 9 lines in your changes missing coverage. Please review.

Project coverage is 97.34%. Comparing base (3d2787b) to head (ce0eb1f).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/providers/ecs_ram_role.ts 77.27% 5 Missing ⚠️
src/providers/session.ts 93.44% 1 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #131      +/-   ##
==========================================
- Coverage   98.00%   97.34%   -0.66%     
==========================================
  Files          36       36              
  Lines        1201     1245      +44     
  Branches      206      214       +8     
==========================================
+ Hits         1177     1212      +35     
- Misses         12       18       +6     
- Partials       12       15       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@peze peze force-pushed the prefetch-upgrade branch 8 times, most recently from 87ffe60 to fc01f90 Compare January 3, 2025 03:53
@peze peze force-pushed the prefetch-upgrade branch from fc01f90 to f273389 Compare January 6, 2025 13:23
@peze peze force-pushed the prefetch-upgrade branch from f273389 to ce0eb1f Compare January 6, 2025 13:40
@yndu13 yndu13 merged commit f49d579 into master Jan 7, 2025
6 checks passed
@yndu13 yndu13 deleted the prefetch-upgrade branch January 7, 2025 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants