mirror of
https://github.com/fergalmoran/chrometophone.git
synced 2025-12-22 09:41:51 +00:00
Fix bug in unregistering old devices, if the oldest didn't include the id.
This commit is contained in:
@@ -133,6 +133,9 @@ public class RegisterServlet extends HttpServlet {
|
||||
// TODO: we should also define a 'ping' message and expire/remove
|
||||
// unused registrations
|
||||
DeviceInfo oldest = registrations.get(0);
|
||||
if (oldest.getRegistrationTimestamp() == null) {
|
||||
pm.deletePersistent(oldest);
|
||||
} else {
|
||||
long oldestTime = oldest.getRegistrationTimestamp().getTime();
|
||||
for (int i = 1; i < registrations.size(); i++) {
|
||||
if (registrations.get(i).getRegistrationTimestamp().getTime() <
|
||||
@@ -143,6 +146,7 @@ public class RegisterServlet extends HttpServlet {
|
||||
}
|
||||
pm.deletePersistent(oldest);
|
||||
}
|
||||
}
|
||||
|
||||
// Get device if it already exists, else create
|
||||
String suffix =
|
||||
|
||||
Reference in New Issue
Block a user