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() {
25
25
try {
26
26
running = true ;
27
27
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
+ }
29
33
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
+ }
31
39
} catch ( err ) {
32
40
log . debug ( "WARNING: Error doing salesloft update" , err ) ;
33
41
} finally {
Original file line number Diff line number Diff line change @@ -59,7 +59,16 @@ export async function updateMoney(cutoff: string = "2 days") {
59
59
}
60
60
const data = await getMoneyData ( account_id ) ;
61
61
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
+ }
63
72
}
64
73
}
65
74
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ const log = logger.debug.bind(logger);
56
56
57
57
export async function sync (
58
58
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
60
60
maxDelayMs : number = 1000 * 60 * 15 , // exponential backoff up to this long.
61
61
) : Promise < {
62
62
update : number ;
You can’t perform that action at this time.
0 commit comments