@@ -45,24 +45,29 @@ def ingest_raw_data():
45
45
def get_contact_data ():
46
46
logger .debug ("Calling get_updated_contact_data()" )
47
47
contact_json = updated_data .get_updated_contact_data ()
48
- logger .debug ("Returning %d contact records" , len (contact_json ))
49
- return jsonify (contact_json ), 200
48
+ if contact_json :
49
+ logger .debug ("Returning %d contact records" , len (contact_json ))
50
+ else :
51
+ logger .debug ("No contact records found" )
52
+ return jsonify ({'outcome' : 'OK' }), 200
50
53
51
54
52
55
@internal_api .route ("/api/internal/start_flow" , methods = ["GET" ])
53
56
def run_flow ():
54
57
logger .debug ("Calling flow_script.start_flow()" )
55
58
flow_script .start_flow ()
56
59
logger .debug ("Flow processing complete" )
57
- return jsonify ('' ), 200
60
+ return jsonify ({ 'outcome' : 'OK' } ), 200
58
61
59
62
60
63
@internal_api .route ("/api/internal/send_salesforce_platform_message" , methods = ["GET" ])
61
64
def send_salesforce_platform_message ():
62
65
contact_list = updated_data .get_updated_contact_data ()
63
- logger .debug ("Returning %d contact records" , len (contact_list ))
64
- salesforce_message_publisher .send_pipeline_update_messages (contact_list )
65
-
66
+ if contact_list :
67
+ logger .debug ("Returning %d contact records" , len (contact_list ))
68
+ salesforce_message_publisher .send_pipeline_update_messages (contact_list )
69
+ else :
70
+ logger .debug ("No contact records found" )
66
71
return jsonify ({'outcome' : 'OK' }), 200
67
72
68
73
@internal_api .route ("/api/internal/full_flow" , methods = ["GET" ])
@@ -73,7 +78,10 @@ def start_flow():
73
78
flow_script .start_flow ()
74
79
logger .info ("Building updated data payload" )
75
80
updated_contacts_list = updated_data .get_updated_contact_data ()
76
- logger .info ("Sending Salesforce platform messages" )
77
- salesforce_message_publisher .send_pipeline_update_messages (updated_contacts_list )
81
+ if updated_contacts_list :
82
+ logger .info ("Sending Salesforce platform messages" )
83
+ salesforce_message_publisher .send_pipeline_update_messages (updated_contacts_list )
84
+ else :
85
+ logger .info ("No contacts to update" )
78
86
79
87
return jsonify ({'outcome' : 'OK' }), 200
0 commit comments