File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed
src/packages/server/salesloft Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,17 @@ export default async function init() {
2525 try {
2626 running = true ;
2727 log . debug ( "Doing a salesloft MONEY update..." ) ;
28- await updateMoney ( "1 day" ) ;
28+ try {
29+ await updateMoney ( "1 day" ) ;
30+ } catch ( err ) {
31+ log . debug ( "WARNING -- issue doing updateMoney" , err ) ;
32+ }
2933 log . debug ( "Doing a salesloft sync update..." ) ;
30- await update ( ) ;
34+ try {
35+ await update ( ) ;
36+ } catch ( err ) {
37+ log . debug ( "WARNING -- issue doing update" , err ) ;
38+ }
3139 } catch ( err ) {
3240 log . debug ( "WARNING: Error doing salesloft update" , err ) ;
3341 } finally {
Original file line number Diff line number Diff line change @@ -59,7 +59,16 @@ export async function updateMoney(cutoff: string = "2 days") {
5959 }
6060 const data = await getMoneyData ( account_id ) ;
6161 log . debug ( "updateMoney: " , { salesloft_id : id , account_id, data } ) ;
62- await update ( id , { custom_fields : data } ) ;
62+ try {
63+ await update ( id , { custom_fields : data } ) ;
64+ } catch ( err ) {
65+ // this can happen, e.g., if the id for the person is no longer in salesloft for some reason
66+ // or just invalid. This is the case with my wstein@sagemath .com account, which caused
67+ // https://github.com/sagemathinc/cocalc/issues/7683
68+ // Better is to just make this a warning and skip those accounts -- salesloft doesn't need
69+ // perfect info about all users.
70+ log . debug ( "WARNING " , err ) ;
71+ }
6372 }
6473}
6574
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ const log = logger.debug.bind(logger);
5656
5757export async function sync (
5858 account_ids : string [ ] ,
59- delayMs : number = 1000 , // wait this long after handling each account_id
59+ delayMs : number = 250 , // wait this long after handling each account_id
6060 maxDelayMs : number = 1000 * 60 * 15 , // exponential backoff up to this long.
6161) : Promise < {
6262 update : number ;
You can’t perform that action at this time.
0 commit comments