Esempio n. 1
0
        private static void ProcessNotify(DBWork work, DBRevisionWork revision_work)
        {
            log.DebugFormat("Running notifiers for lane_id: {1}, revision_id: {2}, host_id: {3}, State: {0}", work.State, revision_work.lane_id, revision_work.revision_id, revision_work.host_id);

            try {
                lock (lock_obj) {
                    List <NotificationBase> notifiers;

                    // We broadcast the notification to the API endpoint
                    WebNotification.BroadcastBuildNotification(work, revision_work);

                    if (!notifications_per_lane.TryGetValue(revision_work.lane_id, out notifiers))
                    {
                        return;
                    }

                    foreach (var notification in notifiers)
                    {
                        notification.Notify(work, revision_work);
                    }
                }
            } catch (Exception ex) {
                log.ErrorFormat("Exception while processing notification: {0}", ex);
            }
        }
Esempio n. 2
0
        private static void ProcessNotify(DBWork work, DBRevisionWork revision_work)
        {
            List <NotificationBase> notifications;

            Logger.Log("Notifications.ProcessNotify (lane_id: {1} revision_id: {2} host_id: {3} State: {0})", work.State, revision_work.lane_id, revision_work.revision_id, revision_work.host_id);

            try {
                lock (lock_obj) {
                    // We broadcast the notification to the API endpoint
                    WebNotification.BroadcastBuildNotification(work, revision_work);

                    if (!notifications_per_lane.TryGetValue(revision_work.lane_id, out notifications))
                    {
                        Logger.Log("Notifications.ProcessNotify (lane_id: {1} revision_id: {2} host_id: {3} State: {0}): Lane doesn't have any notifications enabled", work.State, revision_work.lane_id, revision_work.revision_id, revision_work.host_id);
                        return;
                    }

                    foreach (var notification in notifications)
                    {
                        notification.Notify(work, revision_work);
                    }
                }
            } catch (Exception ex) {
                Logger.Log("Exception while processing notification: {0}", ex.Message);
            }
        }