Reuse Salesforce session id
- Session file
- One worker at a time has ability to lock session file,
auth and write new session id
- Other workers waits and reuse the session id
- Workers compare their session id with the one in file
Change-Id: I371b0a7172a5b312a2ae2aef96d02505a1823f86
Related-bug: PROD-29347 (PROD:29347)
diff --git a/sf_notifier/helpers.py b/sf_notifier/helpers.py
index 295c566..e9c221b 100644
--- a/sf_notifier/helpers.py
+++ b/sf_notifier/helpers.py
@@ -13,10 +13,18 @@
# License for the specific language governing permissions and limitations
# under the License.
+import os
+
RESOLVED_STATUSES = ('UP', 'OK', 'resolved')
+def create_file(file_path):
+ if not os.path.exists(file_path):
+ with open(file_path, 'w+'):
+ return file_path
+
+
def _format_subject(alert):
subject = alert['annotations']['summary']
host = alert['labels'].get('host')