Skip to content

Commit

Permalink
Add assignment load limit
Browse files Browse the repository at this point in the history
  • Loading branch information
crayolakat committed Jan 31, 2024
1 parent d43a128 commit 4a64fb1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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

0 comments on commit 4a64fb1

Please sign in to comment.