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

BC-7561 - separate job for failed batch deletion requests #5448

Open
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

virgilchiriac
Copy link
Contributor

@virgilchiriac virgilchiriac commented Jan 20, 2025

Description

Links to Tickets or other pull requests

BC-7561
hpi-schul-cloud/dof_app_deploy#1095

Approval for review

  • DEV: If api was changed - generate-client:server was executed in vue frontend and changes were tested and put in a PR with the same branch name.
  • QA: In addition to review, the code has been manually tested (if manual testing is possible)
  • All points were discussed with the ticket creator, support-team or product owner. The code upholds all quality guidelines from the PR-template.

this commit changes failed deletion and counted pending requests
 to also be older than configured threshold
add new config var for when pending or failed should
be no longer processed
@virgilchiriac virgilchiriac marked this pull request as ready for review January 20, 2025 10:49
@virgilchiriac virgilchiriac force-pushed the BC-7561-batch-delete-fix branch from 979f793 to ef53fad Compare January 20, 2025 13:06
@virgilchiriac virgilchiriac force-pushed the BC-7561-batch-delete-fix branch from a6bef9f to ee088b5 Compare January 20, 2025 18:37
@virgilchiriac virgilchiriac force-pushed the BC-7561-batch-delete-fix branch 2 times, most recently from ceaa2f4 to b9b6c83 Compare January 23, 2025 10:36
@virgilchiriac virgilchiriac force-pushed the BC-7561-batch-delete-fix branch from b9b6c83 to 8b8e624 Compare January 23, 2025 10:55
@virgilchiriac virgilchiriac force-pushed the BC-7561-batch-delete-fix branch from 165f606 to 51ea68e Compare January 23, 2025 13:01
@virgilchiriac virgilchiriac changed the title BC-7561 - batch delete fix BC-7561 - split batch delete failed requests Jan 23, 2025
],
},
],
const newerThan = new Date(Date.now() - 15 * 60 * 1000); // 15 minutes ago
Copy link
Contributor

Choose a reason for hiding this comment

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

setting variable instead of comment? (same for below)

@@ -851,6 +851,8 @@ describe('UserService', () => {
userRepo.findByIdOrNull.mockResolvedValueOnce(user);
userRepo.deleteUser.mockResolvedValue(1);

config.get.mockReturnValue(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe specify which config get should be mocked instead of a general mock return?

config/default.schema.json Outdated Show resolved Hide resolved
config/default.schema.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@@ -17,5 +16,5 @@ export class DeletionRequestBodyProps {
required: true,
nullable: false,
})
deleteInMinutes?: number = MINUTES_OF_30_DAYS;
deleteAfterMinutes?: number;
Copy link
Contributor

Choose a reason for hiding this comment

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

it is unconventional to use minutes instead of seconds as base time unit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, but also makes overwrites if needed, harder to calculate. Had the same thought to stick to milliseconds, but is not practical either
I just kept the it, just rename the var to better describe what it actually does and relate to db field

@virgilchiriac virgilchiriac changed the title BC-7561 - split batch delete failed requests BC-7561 - separate job for failed batch deletion requests Jan 24, 2025
@virgilchiriac virgilchiriac force-pushed the BC-7561-batch-delete-fix branch 2 times, most recently from 2b16c4f to c0df280 Compare January 24, 2025 20:19
@virgilchiriac virgilchiriac force-pushed the BC-7561-batch-delete-fix branch from c0df280 to e216fc9 Compare January 24, 2025 20:21
@@ -26,9 +26,9 @@ export class DeletionClient {
}
}

public async executeDeletions(limit?: number): Promise<void> {
public async executeDeletions(limit?: number, runFailed?: boolean): Promise<void> {
Copy link
Contributor

@uidp uidp Jan 27, 2025

Choose a reason for hiding this comment

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

Would it make sense to use an options object type instead of sereate parameters? Would better show the independence of limit and runFailed IMHO. (maybe also a matter of taste)

@virgilchiriac virgilchiriac requested a review from uidp January 27, 2025 15:59
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.

4 participants