Skip to content

Commit 3d7f1f7

Browse files
committed
Small fixes
1 parent f8a5aaf commit 3d7f1f7

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

src/main/java/com/prashantchaubey/exceptionlessclient/ExceptionlessClient.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ public void run() {
4343
},
4444
UPDATE_SETTINGS_TIMER_INITIAL_DELAY,
4545
configurationManager.getConfiguration().getUpdateSettingsWhenIdleInterval());
46+
47+
configurationManager.onChanged(
48+
ignored -> configurationManager.getSettingsManager().updateSettingsThreadSafe());
49+
configurationManager
50+
.getQueue()
51+
.onEventsPosted(
52+
(ignored1, ignored2) ->
53+
configurationManager.getSettingsManager().updateSettingsThreadSafe());
4654
}
4755

4856
public static ExceptionlessClient from(String apiKey, String serverUrl) {
@@ -138,6 +146,7 @@ private Event.EventBuilder createEvent() {
138146
.date(LocalDate.now());
139147
}
140148

149+
//todo this should be async
141150
private void submitEvent(
142151
EventPluginContext eventPluginContext, Consumer<EventPluginContext> handler) {
143152
eventPluginRunner.run(
@@ -163,8 +172,8 @@ public void submitSessionEnd(String sessionOrUserId) {
163172
configurationManager.getSubmissionClient().sendHeartBeat(sessionOrUserId, true);
164173
}
165174

166-
public void updateEmailAndDescription(
167-
String referenceId, String email, String description, Consumer<SubmissionResponse> handler) {
175+
public SubmissionResponse updateEmailAndDescription(
176+
String referenceId, String email, String description) {
168177
SubmissionResponse response =
169178
configurationManager
170179
.getSubmissionClient()
@@ -178,7 +187,8 @@ public void updateEmailAndDescription(
178187
String.format(
179188
"Failed to submit user email and description for event: %s", referenceId));
180189
}
181-
handler.accept(response);
190+
191+
return response;
182192
}
183193

184194
public String getLastReferenceId() {

src/main/java/com/prashantchaubey/exceptionlessclient/models/Event.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,18 +169,18 @@ public EventBuilder tags(Set<String> tags) {
169169
}
170170

171171
public EventBuilder tags(String... tags) {
172+
return tags(new HashSet<>(Arrays.asList(tags)));
173+
}
174+
175+
public EventBuilder markAsCritical() {
172176
if (super.tags == null) {
173-
return tags(new HashSet<>(Arrays.asList(tags)));
177+
super.tags = new HashSet<>();
174178
}
175179

176-
super.tags.addAll(new HashSet<>(Arrays.asList(tags)));
180+
super.tags.add(EventTag.CRITICAL.value());
177181
return this;
178182
}
179183

180-
public EventBuilder markAsCritical() {
181-
return tags(EventTag.CRITICAL.value());
182-
}
183-
184184
@Override
185185
public EventBuilder message(String message) {
186186
super.message(message);

0 commit comments

Comments
 (0)