Skip to content

Commit

Permalink
refactor: added logs for unsubscribing demand
Browse files Browse the repository at this point in the history
  • Loading branch information
mgordel committed May 6, 2024
1 parent 0c8cbfd commit 693c2df
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/basic/hello-world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import { pinoPrettyLogger } from "@golem-sdk/pino-logger";

// We managed to create the activity, no need to look for more agreement candidates
proposalSubscription.unsubscribe();
await draftProposal.clear();

// Access your work context to perform operations
const ctx = await glm.activity.createWorkContext(activity);
Expand All @@ -69,6 +70,7 @@ import { pinoPrettyLogger } from "@golem-sdk/pino-logger";

// This will keep the script waiting for payments etc
await lease.finalize();
await glm.payment.releaseAllocation(allocation);
} catch (err) {
console.error("Failed to run example on Golem", err);
} finally {
Expand Down
1 change: 1 addition & 0 deletions src/shared/yagna/adapters/market-api-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class MarketApiAdapter implements MarketApi {
if (result?.message) {
throw new Error(`Failed to unsubscribe from demand: ${result.message}`);
}
this.logger.info("Demand unsubscribed", { demand: demand.id });
}

observeProposalEvents(demand: DemandNew): Observable<ProposalEvent> {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/activityPool.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe("ActivityPool", () => {
afterEach(async () => {
await proposalSubscription.unsubscribe();
await agreementPool.drainAndClear();
proposalPool.clear();
await proposalPool.clear();
});

it("should run a simple script on the activity from the pool", async () => {
Expand Down

0 comments on commit 693c2df

Please sign in to comment.