Skip to content

Conversation

@rhigman
Copy link
Member

@rhigman rhigman commented Jan 28, 2025

No description provided.

@rhigman rhigman requested a review from ja573 January 28, 2025 09:37
Work::create(&context.db, &data).map_err(|e| e.into())
let result = Work::create(&context.db, &data).map_err(|e| e.into());

if let Ok(created_work) = result.clone() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to clone here, you can just reference created_work: if let Ok(ref created_work) = result

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need these to be juniper objects

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// update the work and, if it succeeds, synchronise its children statuses and pub. date
match work.update(&context.db, &data, &account_id) {
Ok(w) => {
let _ = send_event(&context.redis, EventType::WorkUpdated, &w).await;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To discuss: do we need both a WorkUpdated and a WorkPublished when publishing a book?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I don't think we do. I think we should just trigger one event, since if a Work is published, that implies it was updated.

From the broker's perspective, we'd want to avoid double processing the same change.

is_published: work.is_active_withdrawn_superseded(),
event_timestamp: work.updated_at,
};
lpush(redis, QUEUE_KEY, &serde_json::to_string(&event)?).await
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd want a rpush here so we implement a FIFO queue, ie. RPUSH/LPOP

rhigman added 23 commits May 22, 2025 15:09
…karound and hard-coded URL)"

This reverts commit a7d9fb2.
@rhigman rhigman marked this pull request as ready for review July 15, 2025 09:06
@rhigman rhigman requested a review from ja573 July 15, 2025 09:06
@ja573 ja573 changed the base branch from develop to launch/v1.0.0 December 12, 2025 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants