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

Add assignment load limit #9

Merged
merged 4 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions docs/REFERENCE-environment_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
| ASSETS_DIR | Directory path where front-end packaged JavaScript is saved and loaded. _Required_. |
| ASSETS_MAP_FILE | File name of map file, within ASSETS_DIR, containing map of general file names to unique build-specific file names. |
| ASSIGNMENT_CONTACTS_SIDEBAR | Show a sidebar with a list of contacts to the texter. Allows texter to freely navigate between conversations, regardless of status. |
| ASSIGNMENT_LOAD_LIMIT | Limit of contacts to load at one time for an assignment. Used when Spoke is deployed on a service with time and bandwidth limitations, such as AWS Lambda. Type: integer |
| AUTH0_DOMAIN | Domain name on Auth0 account, should end in `.auth0.com`, e.g. `example.auth0.com`. _Required_. |
| AUTH0_CLIENT_ID | Client ID from Auth0 app. _Required_. |
| AUTH0_CLIENT_SECRET | Client secret from Auth0 app. _Required_. |
Expand Down
8 changes: 8 additions & 0 deletions src/server/api/assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ export function getContacts(
query = query.where({
assignment_id: assignment.id
});

let assignmentLoadLimit = getConfig("ASSIGNMENT_LOAD_LIMIT");
if (assignmentLoadLimit) {
assignmentLoadLimit = parseInt(assignmentLoadLimit);
if (!isNaN(assignmentLoadLimit)) {
query.limit(assignmentLoadLimit);
}
}
}

if (contactsFilter) {
Expand Down
Loading