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

feat: add func invoker #744

Merged
merged 12 commits into from
Dec 21, 2024
Merged

Conversation

marsevilspirit
Copy link
Contributor

What this PR does:

This PR supports local method calls (including methods within structs).

Which issue(s) this PR fixes:

Fixes #729

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@marsevilspirit marsevilspirit changed the title feat add func invoker feat: add func invoker Dec 17, 2024

type FuncInvoker struct {
services map[string]FuncService
ServicesMapLock sync.Mutex
Copy link
Contributor

Choose a reason for hiding this comment

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

Put the lock on its guard object

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

我是说把 lock 放在 map 上面,你这还是在 map 下面哦

Copy link
Contributor Author

Choose a reason for hiding this comment

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

哦 我之前理解错了 已修正

@xjlgod
Copy link
Contributor

xjlgod commented Dec 18, 2024

Can this invoker match err to retry?

@marsevilspirit
Copy link
Contributor Author

Can this invoker match err to retry?

support retry now

@@ -191,22 +191,19 @@ func (f *FuncServiceImpl) needRetry(impl *state.ServiceTaskStateImpl, countMap m
return false
}

currentInterval := f.calculateRetryInterval(retry, attempt)
interval := retry.IntervalSecond()
backoffRate := retry.BackoffRate()
Copy link
Contributor

Choose a reason for hiding this comment

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

line 195 以下这块代码可以精简为:
backoffRate := retry.BackoffRate()
curInterval := int64(interval * 1000)
if attempt {
curInterval = int64(interval * backoffRate * float64(attempt) * 1000)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link

@luky116 luky116 merged commit 1385f9e into apache:feature/saga Dec 21, 2024
3 checks passed
@marsevilspirit marsevilspirit deleted the feat-func-invoker branch December 21, 2024 08:26
@marsevilspirit marsevilspirit restored the feat-func-invoker branch December 21, 2024 08:26
@marsevilspirit marsevilspirit deleted the feat-func-invoker branch December 21, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants