Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1116,10 +1116,16 @@ export const Session = new IndexedDBResource({
async getSession() {
return this.get(CURRENT_USER);
},
setSession(currentUser) {
return this.table.put({ CURRENT_USER, ...currentUser });
async setSession(currentUser) {
return this.transaction({ mode: 'rw' }, CHANGES_TABLE, async () => {
const current = await this.getSession();
if (current) {
return this.updateSession(currentUser);
}
return this.table.put({ CURRENT_USER, ...currentUser });
});
},
updateSession(currentUser) {
async updateSession(currentUser) {
return this.update(CURRENT_USER, currentUser);
},
});
Expand Down
5 changes: 4 additions & 1 deletion contentcuration/contentcuration/viewsets/sync/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
from contentcuration.viewsets.sync.constants import CREATED


CHANGE_RETURN_LIMIT = 200


class SyncView(APIView):
authentication_classes = (SessionAuthentication,)
permission_classes = (IsAuthenticated,)
Expand Down Expand Up @@ -104,7 +107,7 @@ def return_changes(self, request, channel_revs):
"table",
"change_type",
"kwargs"
).order_by("server_rev")
).order_by("server_rev")[:CHANGE_RETURN_LIMIT]
)

if not changes_to_return:
Expand Down