Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix DeleteFolder action being sporadically issued by Podbox #1836

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,9 @@ export class LemonadePipeline implements BasePipeline {

const ticketActions: PCDAction[] = [];

if (this.loaded) {
// If the Atom DB is not empty, i.e. if we have loaded atoms for this pipeline
// at least once since the server started, delete the folder.
if ((await this.db.load(this.id)).length > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This has a cost (to fetch from the DB) so I have some thoughts on reducing duplication of that work:

  1. It seems like there's duplicate effort from loading the tickets above. Is it difficult to get this information from the same fetch. Maybe it's tricky since there could be no tickets for the user's email. At least if tickets is non-empty we can assume there are atoms without fetching again, right?
  2. It should at least be possible to do this only once per pipeline instance if the first time you do this fetch you set this.everLoaded.

There are some assumptions here, like the fact that the atom DB is never empty in an active/loaded system. What would happen if an admin simply deleted all the tickets? Would that mean no atoms, and no delete, so that the client-side cleanup would never happen? Or are atoms a more persistent concept than that?

ticketActions.push({
type: PCDActionType.DeleteFolder,
folder: this.definition.options.feedOptions.feedFolder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,9 @@ export class PretixPipeline implements BasePipeline {

const actions: PCDAction[] = [];

if (this.loaded) {
// If the Atom DB is not empty, i.e. if we have loaded atoms for this pipeline
// at least once since the server started, delete the folder.
if ((await this.db.load(this.id)).length > 0) {
actions.push({
type: PCDActionType.DeleteFolder,
folder: this.definition.options.feedOptions.feedFolder,
Expand Down
Loading