Fix a bug that was making it impossible to display billing information in the android app.

This commit is contained in:
MarkBryanMilligan
2022-04-04 17:20:15 -05:00
parent 8387216c44
commit d30fc4b4ce
11 changed files with 52 additions and 24 deletions

View File

@@ -64,6 +64,11 @@ public class MongoRulesDataAccess implements RulesDataAccess {
proxy.save(_device);
}
@Override
public void removeFcmDevice(String _id) {
proxy.delete(FcmDevice.class, new DaoQuery("_id", _id));
}
@Override
public List<FcmDevice> getFcmDevicesForAccount(int _accountId) {
return proxy.query(FcmDevice.class, new DaoQuery("account_id", _accountId));

View File

@@ -17,5 +17,6 @@ public interface RulesDataAccess {
Event getMostRecentEvent(int _accountId, EventType _type, String _sourceId);
List<Event> getEvents(int _accountId, EventType _type, String _sourceId, Date _from, Date _to);
void putFcmDevice(FcmDevice _device);
void removeFcmDevice(String _id);
List<FcmDevice> getFcmDevicesForAccount(int _accountId);
}

View File

@@ -45,6 +45,9 @@ public abstract class AbstractAlertAction implements ActionImpl {
try {
messaging.send(msg);
} catch (Exception _e) {
if (_e.getMessage().contains("not found")) {
RulesEngine.instance().dao().removeFcmDevice(device.getId());
}
logger.error("Failed to send message to account {}, device {}", _rule.getAccountId(), device.getName(), _e);
}
}