Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Disable scheduler.updateLastRun(‘jobName’) in myAction.scala (or in models/Event.scala for sending email digests) by commenting it out. Your events (followed objects for example) will become 'permanent' and the timer job will always execute since there is no update of the lastJobTime variable in the MongoDB job object. Don't forget to enable the updateLastRun() when you are done debugging.

  2. Set the time variables in getJobByTime() in app/services/mongoldb/MongoDBSchedulerService.scala to those saved in the MongoDB job object. The job action will fire every minute since the integer equality is always true. For example for the pre-defined e-mail times (minute=0, hour=7 and day_of_week=1) set getJobByTime()

    Code Block
    languagescala
    def getJobByTime(minute: Integer, hour: Integer, day_of_week: Integer, day_of_month: Integer): List[TimerJob] ={
        val jobs = Jobs.find(
          $and(
            $or($and("day_of_week" $exists true, MongoDBObject("day_of_week" -> 1)), "day_of_week" $exists false),
            $or($and("hour" $exists true, MongoDBObject("hour" -> 7)), "hour" $exists false),
            $or($and("minute" $exists true, MongoDBObject("minute" -> 0)), "minute" $exists false)
          )
        )

    Again, don't forget to reverse changes when you are done debugging.

  3. gg

  4. Testing e-mail digest

    • Add functioning e-mail in app/util/Mail.scala if you use a 'fake' e-mail in your local Clowder developmental branch

      Code Block
      languagescala
      collapsetrue
      def sendEmail(subject: String, user: Option[User], recipient: User, body: Html) {
      	if (recipient.email.isDefined) {
          	Logger.debug("Subject:" + subject + ", From:" + emailAddress(user) + ", Recipient: " + emailAddress(Some(recipient)) + ", Body:")
      		//sendEmail(subject, emailAddress(user), emailAddress(Some(recipient))::Nil, body)
      		sendEmail(subject, emailAddress(user), List("yourEMail@illinois.edu"), body)
      	}
      }
    • Use functioning smtp in securesocial.conf or override it by setting smtp.host and (optional) smtp.from in your custom.conf

      Code Block
      languagescala
      smtp.host=smtp.ncsa.illinois.edu
      smtp.from=yourEMail@illinois.edu

      Note that the host above can be used only within the NCSA's network.

...