mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-15 05:41:51 +08:00
Improve SessionEndTransaction to store player name on retry if user_id is missing
This commit is contained in:
parent
17d39f518d
commit
a1d53b8910
@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.djrapitops.plan.storage.database.transactions.events;
|
||||
|
||||
import com.djrapitops.plan.delivery.domain.PlayerName;
|
||||
import com.djrapitops.plan.exceptions.database.DBOpException;
|
||||
import com.djrapitops.plan.gathering.domain.FinishedSession;
|
||||
import com.djrapitops.plan.gathering.domain.event.JoinAddress;
|
||||
@ -65,7 +66,10 @@ public class SessionEndTransaction extends Transaction {
|
||||
private void retry(DBOpException failed) {
|
||||
try {
|
||||
UUID playerUUID = session.getPlayerUUID();
|
||||
executeOther(new PlayerRegisterTransaction(playerUUID, System::currentTimeMillis, playerUUID.toString()));
|
||||
String playerName = session.getExtraData(PlayerName.class)
|
||||
.map(PlayerName::get)
|
||||
.orElseGet(playerUUID::toString);
|
||||
executeOther(new PlayerRegisterTransaction(playerUUID, session::getStart, playerName));
|
||||
storeSession();
|
||||
} catch (DBOpException anotherFail) {
|
||||
anotherFail.addSuppressed(failed);
|
||||
|
Loading…
Reference in New Issue
Block a user