Skip to content

Commit

Permalink
Merge feature/priorities with parameter rename to addToFront
Browse files Browse the repository at this point in the history
  • Loading branch information
rknell committed Jan 1, 2025
2 parents 61bc8b5 + bbea830 commit 249e210
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 5 deletions.
51 changes: 51 additions & 0 deletions .cursorrules
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Pull Request Review Workflow

## Initial Checks
- fetch latest changes: `git fetch origin | cat`
- check for pull requests: `gh pr list | cat`
- verify the PR author has signed the CLA (if required)
- check if PR is targeting the correct branch: `gh pr view {number} | cat`

## Security & Code Review
- review the pull request to make sure it doesn't contain anything malicious or obfuscated: `gh pr diff {number} | cat`
- scan for sensitive data or credentials
- check for potential security vulnerabilities
- verify code follows project style guidelines and conventions
- review documentation updates

## Issue & Context Review
- check the conversation of the pull request: `gh pr view {number} --comments | cat`
- verify linked issues exist and are properly referenced
- ensure PR description is clear and complete
- check if PR requires updates to API documentation

## Quality Checks
- ensure the pull request doesn't break any CI checks: `gh pr checks {number} | cat`
- verify all status checks are passing
- ensure the pull request is covered by tests
- check test coverage meets minimum requirements: `dart test --coverage | cat`
- ensure the pull request doesn't break or delete any previous tests
- run local tests to verify functionality: `dart test | cat`
- check for performance regressions

## Impact Analysis
- ensure the pull request won't introduce breaking changes
- review dependency updates and their impact: `dart pub outdated | cat`
- check for backward compatibility
- verify API changes are documented

## Merge Process
- if the pull request passes all requirements:
- approve the PR: `gh pr review {number} --approve | cat`
- add appropriate labels: `gh pr edit {number} --add-label "{label}" | cat`
- merge using appropriate strategy: `gh pr merge {number} --{squash|merge|rebase} | cat`
- delete branch if no longer needed: `git branch -d {branch} | cat`

## Post-Merge Tasks
- add necessary updates to the README.md
- update the CHANGELOG.md with new changes
- push the commit to github: `git push origin master | cat`
- update version numbers if needed
- publish to pub.dev: `dart pub publish | cat`
- verify deployment (if applicable)
- close related issues: `gh issue close {number} | cat`
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,25 @@ import 'package:queue/queue.dart';
main() async {
//Create the queue container
final Queue queue = Queue(delay: Duration(milliseconds: 10));
//Add items to the queue asyncroniously
queue.add(()=>Future.delayed(Duration(milliseconds: 100)));
queue.add(()=>Future.delayed(Duration(milliseconds: 10)));
//Get a result from the future in line with await
final result = await queue.add(() async {
await Future.delayed(Duration(milliseconds: 1));
return "Future Complete";
});
//100, 10, 1 will reslove in that order.
result == "Future Complete"; //true
}
```

#### Parallel processing
This doesn't work in batches and will fire the next item as soon as as there is space in the queue
Use [Queue(delayed: ...)] to specify a delay before firing the next item
Use [Queue(delayed: ...)] to specify a delay before firing the next item

```dart
import 'package:queue/queue.dart';
Expand Down Expand Up @@ -106,6 +106,26 @@ main() async {
}
```

#### Adding items to the front of the queue
You can add items to the front of the queue to process them sooner using the `addToFront` parameter:

```dart
import 'package:queue/queue.dart';
main() async {
final queue = Queue();
// Add a regular item to the queue
queue.add(() => Future.delayed(Duration(milliseconds: 100)));
// Add an urgent item that should be processed next
queue.add(
() => Future.delayed(Duration(milliseconds: 50)),
addToFront: true
);
}
```

#### Cancel

If you need to stop a queue from processing call Queue.cancel();
Expand Down Expand Up @@ -155,7 +175,7 @@ queue.dispose(); // Will clean up any resources in the queue if you are done wit

## Contributing

Pull requests are welcome. There is a shell script `ci_checks.sh` that will run the checks to get
Pull requests are welcome. There is a shell script `ci_checks.sh` that will run the checks to get
past CI and also format the code before committing. If that all passes your PR will likely be accepted.

Please write tests to cover your new feature.

0 comments on commit 249e210

Please sign in to comment.