Skip to content

lib/model: Return empty summary on paused folders (ref #6272) - #6326

Merged
calmh merged 3 commits into
syncthing:masterfrom
imsodin:model/emptySummary
Feb 12, 2020
Merged

calmh merged 3 commits into
syncthing:masterfrom
imsodin:model/emptySummary

Conversation

@imsodin

@imsodin imsodin commented Feb 11, 2020

Copy link
Copy Markdown
Member

This now actually addresses the 404 on the rest api that makes trouble for SyncTrayzor (https://forum.syncthing.net/t/rest-db-status-returns-404-on-startup/14329). The behaviour is, that we return an empty folder summary in that case. I think that's not a good API and instead the folder summary service should have access to the db for paused folders as well (e.g. global and local state are still useful info then), but that's a much bigger change. This just makes sure the behaviour doesn't change.

I didn't add a rest api error, as it can't use the model package. However I added a test in the model that makes sure that no error is returned when getting a folder summary for a paused folder.

Comment thread lib/model/model_test.go Resolved
errors, err := c.model.FolderErrors(folder)
if err == nil {
var snap *db.Snapshot
if snap, err = c.model.DBSnapshot(folder); err == nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

release dat snap

@calmh calmh Feb 12, 2020 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, DBSnapshot still returns errFolderMissing for non-started folders does it not?

No, I guess that's if it's actually missing from the config, which is fine. 👍

@AudriusButkevicius AudriusButkevicius Feb 12, 2020 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The snap is released (end of the if block) if its acquired.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now it is, yes, but it wasn't when I commented. :)

@calmh

calmh commented Feb 12, 2020

Copy link
Copy Markdown
Member

Needs merge

@calmh
calmh merged commit ce27780 into syncthing:master Feb 12, 2020
@calmh calmh added this to the v1.4.0 milestone Feb 12, 2020
@imsodin
imsodin deleted the model/emptySummary branch February 12, 2020 11:14
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Feb 12, 2021
@syncthing syncthing locked and limited conversation to collaborators Feb 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants