Skip to content

Commit

Permalink
Fix bug in async publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
agentgt committed Jan 10, 2024
1 parent 56dc355 commit d30ca38
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/io/jstach/rainbowgum/LogProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ default Property<T> build(String key) {
String fqn = fullyQualifiedKey(key);
if (!fqn.startsWith(LogProperties.ROOT_PREFIX)) {
throw new IllegalArgumentException(
"Property key should start with: '" + LogProperties.ROOT_PREFIX + "'");
"Property key should start with: '" + LogProperties.ROOT_PREFIX + "'. key = " + key);
}
return new Property<>(this, key);
}
Expand All @@ -689,7 +689,7 @@ default Property<T> build(String key) {
* @return property.
*/
default Property<T> buildWithName(String key, String name) {
String fqn = LogProperties.interpolateKey(name, Map.of(NAME, name));
String fqn = LogProperties.interpolateKey(key, Map.of(NAME, name));
return build(fqn);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ public void run() {

private void drain() {
try {
int count = queue.drainTo(fake, bufferSize);
assert count == fake.size;
append(buffer, count);
queue.drainTo(fake, bufferSize);
append(buffer, fake.size);
}
finally {
fake.reset();
Expand Down
3 changes: 1 addition & 2 deletions core/src/test/java/io/jstach/rainbowgum/RainbowGumTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ void testFormatterBuilder() throws Exception {
r.publisher(PublisherProvider.async().build());
r.appender(sysout);
r.level(Level.WARNING, "stuff");
}).build()) {
}).build().start()) {

gum.start();
gum.router().log("stuff", Level.INFO, "Stuff", null);
gum.router().log("stuff", Level.ERROR, "bad", null);

Expand Down

0 comments on commit d30ca38

Please sign in to comment.