reminders-cli icon indicating copy to clipboard operation
reminders-cli copied to clipboard

Times out

Open wongjustin99 opened this issue 8 years ago • 6 comments

On a couple of computers, one El Capitan, one Sierra, I get an AppleScript timeout on both.

script:64:109: execution error: Reminders got an error: AppleEvent timed out. (-1712)

Is there a way to fix this or extend the timeout?

wongjustin99 avatar Oct 23 '17 17:10 wongjustin99

@wongjustin99: can you tell me which command timed out? every command on applescript has a maximum execution time of 2 minutes, it's weird that the cli is exceeding it.

lucasbento avatar Oct 24 '17 06:10 lucasbento

I was trying reminders --list.

Here's a fuller stack trace:

➜   reminders-cli git:(master) ✗  reminders --list
⠸ Loading reminders^CError: /usr/local/lib/node_modules/reminders-cli/dist/commands/../scripts/get_reminders.applescript:64:109: execution error: Reminders got an error: AppleEvent timed out. (-1712)

    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/reminders-cli/node_modules/applescript/lib/applescript.js:49:13)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)

wongjustin99 avatar Oct 24 '17 15:10 wongjustin99

I just ran the dev version and added a 1-hour timeout instead and that got it to work. I think something about your get_reminders.applescript is timing out with a lot of reminders.

wongjustin99 avatar Oct 24 '17 15:10 wongjustin99

@wongjustin99: hmm, how many reminders do you have? Did you see how long it takes to list all of them after you updating the timeout?

lucasbento avatar Oct 25 '17 06:10 lucasbento

Counting completed? Spread around 10 or so lists, 1000-1300. Not completed? Less than 100.

Yeah, it took around 15 minutes, and it locked up the native Reminders application as well. I think that loop may not be the most efficient.

Here's how I added that timeout:

with timeout of (30 * 60) seconds
  tell application "Reminders"
      set reminderList to {}
      if (count of (reminders whose completed is false)) > 0 then
          set reminderList to name of reminders whose completed is false
      end if

      quit
      return reminderList
  end tell
end timeout

On 25 October 2017 at 02:57, Lucas Bento [email protected] wrote:

@wongjustin99 https://github.com/wongjustin99: hmm, how many reminders do you have? Did you see how long it takes to list all of them after you updating the timeout?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lucasbento/reminders-cli/issues/2#issuecomment-339233224, or mute the thread https://github.com/notifications/unsubscribe-auth/ABgsDjQKF8JpTnJUTRtE9sjf-uJW5qxiks5svtvQgaJpZM4QDO5D .

wongjustin99 avatar Oct 25 '17 13:10 wongjustin99

Yeah, gotta improve the loop perf, I'll try to have a look on it once I have some free time.

Thank you for reporting it, @wongjustin99!

lucasbento avatar Oct 26 '17 09:10 lucasbento