fle-internal/ka-lite-central — pull request #142 by jamalex (2014-04-28 18:45:01+00:00)
Title: Fixes to deleting older sync sessions

Was getting an error trying to `syncmodels` against release-0.12.0 running on `globe`:
`Error: Unexpected error: (1235, "This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'")`

Traced this to the following code that is run when a `SyncSession` is saved:
```
to_discard = SyncSession.objects.order_by("timestamp")[0:SyncSession.objects.count()-settings.SYNC_SESSIONS_MAX_RECORDS]
SyncSession.objects.filter(pk__in=to_discard).delete()
```

Two problems here:
1. This should not be happening on the central server at all, as it's going to delete a large volume of important data (used to generate the IP map, etc), and interfere with other in-progress sync sessions if more than 10 are active.
2. There's no need for the extra filter in the second line. We already have the queryset, and can just delete it directly.

Approach:
1. Disabled the max sync session count, so it now needs to be enabled manually.
2. Fixed the second line to delete the queryset directly.