Created
January 22, 2014 11:43
-
-
Save jmettraux/8557346 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19:54 puppeh has joined ([email protected]) | |
19:55 puppeh: can I ask about rufus-scheduler? | |
19:58 puppeh: I try to do a :first_in => Time.now but it throws: cannot set first[_at|_in] in the past: 1.0e-07 -> 2014-01-22 10:44:32 +0000 (ArgumentError) | |
19:58 puppeh: I want to run the job to be run immediately the first time | |
19:59 jmettraux: puppeh: hello, welcome to #ruote | |
20:00 jmettraux: if you want it to run immediately, don't set any :first_in | |
20:01 puppeh: so this: scheduler.every '10s' do | |
20:01 puppeh: will run immediately the first time and then after each 10" ? | |
20:02 jmettraux: unfortunately, it will run for the first time after 10 seconds | |
20:02 puppeh: that's what I'm talking about :P | |
20:02 puppeh: so there isn't a way to make it run immediately the first time and then after each 10secs? | |
20:02 jmettraux: but you can wrap the block in a proc, call it immediately and then (or right before) schedule it | |
20:02 jmettraux: basic ruby | |
20:03 chiradeep has joined | |
20:04 jmettraux: not sure if trying with :first_in => '1s' would work, I'd have to look at the code (or you could try for yourself) | |
20:08 puppeh: jmettraux: something like http://pastie.org/8656742 ? | |
20:08 jmettraux: yes, but | |
20:08 chiradeep has left IRC (Ping timeout: 264 seconds) | |
20:08 jmettraux: you can write ```scheduler.every '2', j``` | |
20:08 jmettraux: or ```scheduler.every '2', &j``` IIRC | |
20:10 puppeh: I don't get the syntax :P | |
20:10 puppeh: what are all the ``` ? | |
20:11 jmettraux: on github, ``` is used to delimit source code | |
20:11 puppeh: oh ok | |
20:11 jmettraux: cf http://github.github.com/github-flavored-markdown/ | |
20:12 puppeh: jmettraux: this worked, thanks: http://pastie.org/8656750 | |
20:12 jmettraux: it might be interesting to add a switch to do "in 10 seconds and right now", I will think about it | |
20:13 jmettraux: cool, well done ! | |
20:13 puppeh: I could also use a lambda right? | |
20:13 puppeh: jmettraux: I'd be happy to submit a PR | |
20:13 puppeh: btw here's my answer: http://stackoverflow.com/a/21281077/1242778 | |
20:13 jmettraux: I can't remember the diff between procs and lambdas, but it should be ok | |
20:13 puppeh: jmettraux: I knew about the ```, it's just that for one-liners I just use single ` :) | |
20:14 puppeh: well they behave different when using `return` | |
20:14 jmettraux: single quote is single quote | |
20:15 jmettraux: lol, I should get the SO points, not you | |
20:16 puppeh: yes :) | |
20:16 puppeh: single backtick also marks code in markdown | |
20:16 jmettraux: https://github.com/jmettraux/rufus-scheduler/issues/96 I will think about it | |
20:17 jmettraux: ah, backtick, thanks | |
20:17 puppeh: yes it's just inline, while the triple marks multi-line | |
20:17 puppeh: (it's me who answered on the issue) | |
20:18 jmettraux: understood that | |
20:18 puppeh: :P | |
20:21 jmettraux: not sure how it should be shaped, need to sleep on it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment