Sharing: send the answer directly on the same stack

Open
#5,236 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
api, backend

Research direction

Start with SendAnswer in model/sharing/oauth.go and the /answer handler that calls ProcessAnswer. Compare the local and remote owner paths, preserving the credentials exchange and errors used by share-autoaccept retries. Add tests for local and remote owners, then check the fanout load test: when all members are on one stack, it should make no /answer HTTP calls.

Written by the indexing model from the issue text.

Description

When a recipient accepts, SendAnswer (model/sharing/oauth.go) sends POST /sharings/:id/answer to the owner, even when the owner is on the same stack. Under load, these answers get 409s (#5146).

  • When the owner is on this stack (LocalInstanceFromURL, from #4785), call its ProcessAnswer directly. The /answer handler only calls ProcessAnswer, so the checks stay the same.
  • Keep the credentials exchange as it is, so later calls still work.
  • Return the same errors as the HTTP path, so the share-autoaccept retries still work. Use HTTP only when the owner is not on this stack.
  • Tests: local owner, remote owner. In the fanout load test (#5235) with all members on one stack, no /answer HTTP calls.

Size: ~200 lines. Depends on: nothing.

Dominant language
Go
Stars
1.3k
Forks
147
Avg merge
22h 40m
Merged PRs (30d)
134

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from linagora/cozy-stack

All issues in linagora/cozy-stack

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.