Search in sources :

Example 1 with FederationPullStatus

use of com.gitblit.Constants.FederationPullStatus in project gitblit by gitblit.

the class FederationPullService method run.

/**
	 * Run method for this pull service.
	 */
@Override
public void run() {
    for (FederationModel registration : registrations) {
        FederationPullStatus was = registration.getLowestStatus();
        try {
            Date now = new Date(System.currentTimeMillis());
            pull(registration);
            sendStatusAcknowledgment(registration);
            registration.lastPull = now;
            FederationPullStatus is = registration.getLowestStatus();
            if (is.ordinal() < was.ordinal()) {
                // the status for this registration has downgraded
                logger.warn("Federation pull status of {0} is now {1}", registration.name, is.name());
                if (registration.notifyOnError) {
                    String message = "Federation pull of " + registration.name + " @ " + registration.url + " is now at " + is.name();
                    gitblit.sendMailToAdministrators("Pull Status of " + registration.name + " is " + is.name(), message);
                }
            }
        } catch (Throwable t) {
            logger.error(MessageFormat.format("Failed to pull from federated gitblit ({0} @ {1})", registration.name, registration.url), t);
        } finally {
            reschedule(registration);
        }
    }
}
Also used : FederationModel(com.gitblit.models.FederationModel) FederationPullStatus(com.gitblit.Constants.FederationPullStatus) Date(java.util.Date)

Aggregations

FederationPullStatus (com.gitblit.Constants.FederationPullStatus)1 FederationModel (com.gitblit.models.FederationModel)1 Date (java.util.Date)1