mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
Fix cache invalidation when group data changes (#1010)
This commit is contained in:
parent
f4882c1c14
commit
a90e59ec97
@ -77,7 +77,8 @@ public abstract class AbstractConnectionListener implements ConnectionListener {
|
|||||||
User user = this.plugin.getStorage().loadUser(u, username).join();
|
User user = this.plugin.getStorage().loadUser(u, username).join();
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw new NullPointerException("User is null");
|
throw new NullPointerException("User is null");
|
||||||
} else {
|
}
|
||||||
|
|
||||||
// Setup defaults for the user
|
// Setup defaults for the user
|
||||||
boolean save = false;
|
boolean save = false;
|
||||||
for (AssignmentRule rule : this.plugin.getConfiguration().get(ConfigKeys.DEFAULT_ASSIGNMENTS)) {
|
for (AssignmentRule rule : this.plugin.getConfiguration().get(ConfigKeys.DEFAULT_ASSIGNMENTS)) {
|
||||||
@ -90,7 +91,6 @@ public abstract class AbstractConnectionListener implements ConnectionListener {
|
|||||||
if (save) {
|
if (save) {
|
||||||
this.plugin.getStorage().saveUser(user).join();
|
this.plugin.getStorage().saveUser(user).join();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
final long time = System.currentTimeMillis() - startTime;
|
final long time = System.currentTimeMillis() - startTime;
|
||||||
if (time >= 1000) {
|
if (time >= 1000) {
|
||||||
|
@ -80,6 +80,11 @@ public class AbstractStorage implements Storage {
|
|||||||
return this.dao;
|
return this.dao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiStorage getApiDelegate() {
|
||||||
|
return this.apiDelegate;
|
||||||
|
}
|
||||||
|
|
||||||
private <T> CompletableFuture<T> makeFuture(Callable<T> supplier) {
|
private <T> CompletableFuture<T> makeFuture(Callable<T> supplier) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
try {
|
try {
|
||||||
@ -102,11 +107,6 @@ public class AbstractStorage implements Storage {
|
|||||||
}, this.dao.getPlugin().getBootstrap().getScheduler().async());
|
}, this.dao.getPlugin().getBootstrap().getScheduler().async());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ApiStorage getApiDelegate() {
|
|
||||||
return this.apiDelegate;
|
|
||||||
}
|
|
||||||
|
|
||||||
private interface ThrowingRunnable {
|
private interface ThrowingRunnable {
|
||||||
void run() throws Exception;
|
void run() throws Exception;
|
||||||
}
|
}
|
||||||
|
@ -203,6 +203,7 @@ public abstract class AbstractConfigurateDao extends AbstractDao {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw reportException(uuid.toString(), e);
|
throw reportException(uuid.toString(), e);
|
||||||
} finally {
|
} finally {
|
||||||
|
user.invalidateCachedData();
|
||||||
user.getIoLock().unlock();
|
user.getIoLock().unlock();
|
||||||
}
|
}
|
||||||
return user;
|
return user;
|
||||||
@ -258,6 +259,7 @@ public abstract class AbstractConfigurateDao extends AbstractDao {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw reportException(name, e);
|
throw reportException(name, e);
|
||||||
} finally {
|
} finally {
|
||||||
|
group.invalidateCachedData();
|
||||||
group.getIoLock().unlock();
|
group.getIoLock().unlock();
|
||||||
}
|
}
|
||||||
return group;
|
return group;
|
||||||
@ -290,6 +292,7 @@ public abstract class AbstractConfigurateDao extends AbstractDao {
|
|||||||
throw reportException(name, e);
|
throw reportException(name, e);
|
||||||
} finally {
|
} finally {
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
|
group.invalidateCachedData();
|
||||||
group.getIoLock().unlock();
|
group.getIoLock().unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -286,6 +286,7 @@ public class MongoDao extends AbstractDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
user.invalidateCachedData();
|
||||||
user.getIoLock().unlock();
|
user.getIoLock().unlock();
|
||||||
}
|
}
|
||||||
return user;
|
return user;
|
||||||
@ -356,6 +357,7 @@ public class MongoDao extends AbstractDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
group.invalidateCachedData();
|
||||||
group.getIoLock().unlock();
|
group.getIoLock().unlock();
|
||||||
}
|
}
|
||||||
return group;
|
return group;
|
||||||
@ -385,6 +387,7 @@ public class MongoDao extends AbstractDao {
|
|||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
|
group.invalidateCachedData();
|
||||||
group.getIoLock().unlock();
|
group.getIoLock().unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,6 +355,7 @@ public class SqlDao extends AbstractDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
user.invalidateCachedData();
|
||||||
user.getIoLock().unlock();
|
user.getIoLock().unlock();
|
||||||
}
|
}
|
||||||
return user;
|
return user;
|
||||||
@ -596,6 +597,7 @@ public class SqlDao extends AbstractDao {
|
|||||||
group.clearNodes();
|
group.clearNodes();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
group.invalidateCachedData();
|
||||||
group.getIoLock().unlock();
|
group.getIoLock().unlock();
|
||||||
}
|
}
|
||||||
return Optional.of(group);
|
return Optional.of(group);
|
||||||
|
Loading…
Reference in New Issue
Block a user