<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="154770" data-post-id="154770">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sorentwo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sorentwo/120/37360_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sorentwo
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Oban Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Oban v0.12.1 is out with a couple of helpful bug fixes around running cronjobs, some testing improvements, and a bit of documentation about what <code>oban_beats</code> is for. Thanks to everybody that contributed <img src="https://forum.elixirforum.com/images/emoji/apple/yellow_heart.png?v=15" title=":yellow_heart:" class="emoji" alt=":yellow_heart:" loading="lazy" width="20" height="20"></p>
<p>From the <a href="https://github.com/sorentwo/oban/blob/master/CHANGELOG.md#0121--2019-12-13" rel="noopener nofollow ugc">CHANGELOG</a></p>
<h3><a name="p-154770-fixed-1" class="anchor" href="#p-154770-fixed-1" aria-label="Heading link" rel="nofollow"></a>Fixed</h3>
<ul>
<li>[Oban.Worker] Deep merge <code>unique</code> options between the worker and custom params. Previously the <code>unique</code> options passed to <code>Worker.new/2</code> would completely override the options stored by <code>use Oban.Worker</code>. This was primarily an issue for crontab jobs, where the period is always passed by the scheduler. <a class="mention" href="/u/brighteyesdavid" rel="nofollow">@BrightEyesDavid</a></li>
</ul>
<h3><a name="p-154770-changed-2" class="anchor" href="#p-154770-changed-2" aria-label="Heading link" rel="nofollow"></a>Changed</h3>
<ul>
<li>
<p>[Oban] Allow setting <code>crontab: false</code> or <code>crontab: nil</code> to disable scheduling. This matches the <code>queues</code> behavior and makes it possible to override the default configuration within each environment, i.e. when testing.</p>
</li>
<li>
<p>[Oban.Testing] Better error message for <code>Oban.Testing.assert_enqueued/2</code> <a class="mention" href="/u/axelson" rel="nofollow">@axelson</a></p>
</li>
</ul> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="154770" data-batch-url="/posts/batch_likers">
                        6
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/oban-reliable-and-observable-job-processing/22449/143">Post #142</a>
	                </div>
	            </div>
              <div id="likers-container-154770" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="154770"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #142"></div>
  </section>
</div>
    <div class="postbit" id="157092" data-post-id="157092">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="amnu3387" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  amnu3387
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I haven’t tried yet v0.12.1 (I’m on v0.11.1) but just wanted to say this a great lib and it has made some workflows really smooth and straightforward. Thanks for sharing!</p>
<p>I would be happy to contribute, but I didn’t see any issues on the repo (a good sign ?).<br>
I’ve had the need to use some “locks” and I solved it with an Ecto.Transaction that first tries to insert a “lock” record (where the primary key is the lock term - a string identifier) then inserts the actual job, the lock record would be deleted after the job has run (either successfully or maxed out the retries), or optionally only deleted if the job as failed (like saying, this has been run for this specific lock already).</p>
<p>It’s similar to the unique queue item, but by my reading the unique option always requires a period, sometimes though you simply want to be sure that if a given type of job is already queued that it shouldn’t queue another one until the lock is free (and using a lock key as a string allows you to interpolate for instance a date, or wtv in it). I think it can help ensuring no other job is scheduled in case of failure &amp; restart of a process responsible for enqueuing, a node start/restart, etc. Or perhaps not. If you think this could be useful I can try to work on a PR and discuss it (on github)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="157092" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/oban-reliable-and-observable-job-processing/22449/144">Post #143</a>
	                </div>
	            </div>
              <div id="likers-container-157092" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="157092"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #143"></div>
  </section>
</div>
    <div class="postbit" id="157109" data-post-id="157109">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sorentwo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sorentwo/120/37360_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sorentwo
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Oban Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="amnu3387" data-post="144" data-topic="22449">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/a/ed8c4c/48.png" class="avatar"> amnu3387:</div>
<blockquote>
<p>I would be happy to contribute, but I didn’t see any issues on the repo (a good sign ?).</p>
</blockquote>
</aside>
<p>It should be a good sign! There are some features and changes that I have in a local TODO which aren’t listed as open issues. I’ll write them up and see if anybody wants to work on them to contribute.</p>
<aside class="quote no-group" data-username="amnu3387" data-post="144" data-topic="22449">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/a/ed8c4c/48.png" class="avatar"> amnu3387:</div>
<blockquote>
<p>It’s similar to the unique queue item, but by my reading the unique option always requires a period, sometimes though you simply want to be sure that if a given type of job is already queued that it shouldn’t queue another one until the lock is free (and using a lock key as a string allows you to interpolate for instance a date, or wtv in it). I think it can help ensuring no other job is scheduled in case of failure &amp; restart of a process responsible for enqueuing, a node start/restart, etc. Or perhaps not. If you think this could be useful I can try to work on a PR and discuss it (on github)</p>
</blockquote>
</aside>
<p>If I understand your use case correctly then you can do this currently with unique options. The <code>period</code> option is required, but you can set it to an arbitrarily high number. Additionally, by changing the <code>states</code> to only include <code>available</code>, <code>scheduled</code>, <code>retryable</code> and <code>executing</code> you will prevent running a duplicate job but can freely run the same job repeatedly provided that it completes.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule MyApp.Worker do
  @one_week 60 * 60 * 24 * 7

  use Oban.Worker, unique: [
    period: @one_week,
    states: ~w(available scheduled executing retryable)a,
    fields: ~w(queue worker)a
  ]

  # ...
end
</code></pre>
<p>The upcoming release also has the <a href="https://github.com/sorentwo/oban/commit/4828cd1f86f13d6d9a3cc6fee3df20714da5d442" rel="noopener nofollow ugc">addition of xact lock during insert</a>, which makes uniqueness guaranteed even during concurrent inserts.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="157109" data-batch-url="/posts/batch_likers">
                        4
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/oban-reliable-and-observable-job-processing/22449/145">Post #144</a>
	                </div>
	            </div>
              <div id="likers-container-157109" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="157109"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #144"></div>
  </section>
</div>
    <div class="postbit" id="157180" data-post-id="157180">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="amnu3387" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  amnu3387
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>So my use case was basically scheduling emails for every 1st day of a month, and I wanted it to be able to whenever you start an application (imagine you just deployed the first time) and it would create the job for doing the actual delivery to sendgrid with a scheduled at. The problem was the sendgrid email has to be sent close to the sending deadline because theoretically users might had sign up anytime before the scheduling and you would still want them to receive the email no matter what, so fetching what users to deliver to has to be postponed to an hour or 2 of the email going off.</p>
<p>And then the sendgrid request had to account for any arbitrary number of delivery targets and in order to prevent a gigantic http request (because of the data points being sent for the templates being partially unique and partially shared but the shared parts still having to be included in each data_for_template item), it has to batch the delivery.</p>
<p>Then months have this weird peculiarity that they have different days length. So if a job was scheduled at the first of Jan, to be delivered on the first of Feb, there would be a uniqueness period of 31 days, but then of Feb, that period would be different, and I would need to convolute the logic in order to guarantee working periods I guess? It seemed complex to do (or more complex than I wanted).</p>
<p>So I made that transaction thing, creating a table for the locks with just a primary key which is the lock identifier itself.<br>
Basically</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">|&gt; Multi.insert(:job_lock, %Lock{id: "lock_some_identifier_01_01_2020"})
|&gt; Multi.run(:job, fn(_, _) -&gt; do_oban_insert(params) end)
|&gt; Multi.insert(:job_lock_to_keep, %Lock{id: "scheduled_some_identifier_01_01_2020"})
|&gt; Multi.delete(:delete_job_lock.....)
|&gt; Repo.transaction()
</code></pre>
<p>Probably I could rely on just leaving the first “job_lock” and not doing the second one afterwards.<br>
The <code>do_oban_isert </code> schedules the job to be run on wtv time.<br>
Then the job worker picks it up and tries to deliver the thing in batches, for each batch it creates another two jobs in a transaction, one to fetch the next batch and other to deliver for the current batch, so that you don’t have mid batch failures restarting the whole thing and duplicate emails being sent, etc, if the job for the batch fails being inserted, only the insertion of that job is repeated, etc.</p>
<p>I might be wrong but this ended up appearing to me to be the best way to guarantee no duplication of email sending without having to fiddle with time periods, since the lock identifiers are reproducible at any point in time.</p>
<p>I’ve read the <code>xact lock</code> link, but how does that work? Is it a lock that is not temporary?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="157180" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/oban-reliable-and-observable-job-processing/22449/146">Post #145</a>
	                </div>
	            </div>
              <div id="likers-container-157180" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="157180"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #145"></div>
  </section>
</div>
    <div class="postbit" id="157186" data-post-id="157186">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sorentwo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sorentwo/120/37360_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sorentwo
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Oban Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="amnu3387" data-post="146" data-topic="22449">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/a/ed8c4c/48.png" class="avatar"> amnu3387:</div>
<blockquote>
<p>So my use case was basically scheduling emails for every 1st day of a month, and I wanted it to be able to whenever you start an application (imagine you just deployed the first time) and it would create the job for doing the actual delivery to sendgrid with a scheduled at. The problem was the sendgrid email has to be sent close to the sending deadline because theoretically users might had sign up anytime before the scheduling and you would still want them to receive the email no matter what, so fetching what users to deliver to has to be postponed to an hour or 2 of the email going off.</p>
</blockquote>
</aside>
<p>This sounds like a perfect use case for a CRON job. You can schedule the job to run at the first of the month at a particular time using a specific timezone (on master):</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">config :my_app, Oban,
  repo: MyApp.Repo,
  timezone: "Europe/Lisbon",
  crontab: [
    {"0 8 1 * *", MyApp.MailingWorker}
  ]
</code></pre>
<p>That will kick off the email at 8am on the 1st of each month.</p>
<aside class="quote no-group" data-username="amnu3387" data-post="146" data-topic="22449">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/a/ed8c4c/48.png" class="avatar"> amnu3387:</div>
<blockquote>
<p>And then the sendgrid request had to account for any arbitrary number of delivery targets and in order to prevent a gigantic http request (because of the data points being sent for the templates being partially unique and partially shared but the shared parts still having to be included in each data_for_template item), it has to batch the delivery.</p>
</blockquote>
</aside>
<p>I’d make the scheduled job only responsible for generating smaller batch jobs which do the actual sending. You get isolation for failure as well as horizontal scaling:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule MyApp.MailingWorker do
  use Oban.Worker, queue: :mailer

  import Ecto.Query

  @batch_size 100

  @impl Oban.Worker
  def perform(%{"emails" =&gt; emails}, _job) do
    # do the batch email delivery
  end

  def perform(_args, _job) do
    MyApp.User
    |&gt; select([u], u.email)
    |&gt; MyApp.Repo.all()
    |&gt; Enum.chunk_every(@batch_size)
    |&gt; Enum.map(fn emails -&gt; new(%{emails: emails}) end)
    |&gt; Oban.insert_all()
  end
end
</code></pre>
<p>The second <code>perform/2</code> clause is called by the scheduled job and enqueues all of the batches in one go. I made up some schema names and chose an arbitrary batch size of 100 purely for illustration purposes. Anyhow, the scheduled job will succeed or fail atomically.</p>
<p>Each of the batches will hit the first <code>perform/2</code> clause and do the actual work of delivering your emails. If there is a problem with one of the batches it won’t impact any of the others and it should retry without sending duplicates.</p>
<p>In this case I don’t think you need to specify uniqueness at all.</p>
<aside class="quote no-group" data-username="amnu3387" data-post="146" data-topic="22449">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/a/ed8c4c/48.png" class="avatar"> amnu3387:</div>
<blockquote>
<p>I’ve read the <code>xact lock</code> link, but how does that work? Is it a lock that is not temporary?</p>
</blockquote>
</aside>
<p>The <code>xact lock</code> is an advisory lock that only lives as long as the transaction. It is highly temporary and is used to prevent inserting jobs from simultaneous transactions (like when a user clicks a button twice and it hits the server with two separate requests).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="157186" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/oban-reliable-and-observable-job-processing/22449/147">Post #146</a>
	                </div>
	            </div>
              <div id="likers-container-157186" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="157186"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #146"></div>
  </section>
</div>
    <div class="postbit" id="157284" data-post-id="157284">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="amnu3387" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  amnu3387
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Nice addition - does it run an actual crontab or is it a cronlike interface inside oban itself?<br>
I didn’t use crontabs because they need some babysitting/manual scheduling in some edge cases unless you can repeat them every day (interval wtv) in an idempotent way.</p>
<p>I hadn’t thought about the enum chunk and inserting them with <code>insert_all</code>. Was <code>insert_all</code> always available? I think I missed it (I started using oban in the earlier versions and only used the newer versions now). That looks cleaner than my solution.</p>
<p>Ah, yes, for the <code>xact lock</code> it makes sense, but that’s why I wasn’t understanding how it tied back if it was a temporary transaction lock. Thanks  for the explanation and samples!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="157284" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/oban-reliable-and-observable-job-processing/22449/148">Post #147</a>
	                </div>
	            </div>
              <div id="likers-container-157284" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="157284"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #147"></div>
  </section>
</div>
    <div class="postbit" id="157289" data-post-id="157289">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sorentwo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sorentwo/120/37360_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sorentwo
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Oban Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="amnu3387" data-post="148" data-topic="22449">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/a/ed8c4c/48.png" class="avatar"> amnu3387:</div>
<blockquote>
<p>Nice addition - does it run an actual crontab or is it a cronlike interface inside oban itself?<br>
I didn’t use crontabs because they need some babysitting/manual scheduling in some edge cases unless you can repeat them every day (interval wtv) in an idempotent way.</p>
</blockquote>
</aside>
<p>It uses a cron-like interface inside of Oban itself.</p>
<aside class="quote no-group" data-username="amnu3387" data-post="148" data-topic="22449">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/a/ed8c4c/48.png" class="avatar"> amnu3387:</div>
<blockquote>
<p>I hadn’t thought about the enum chunk and inserting them with <code>insert_all</code> . Was <code>insert_all</code> always available?</p>
</blockquote>
</aside>
<p>No, it wasn’t added until a little while ago in v0.9.0. It is a huge improvement over inserting individual jobs one at a time, but <a href="https://hexdocs.pm/oban/Oban.html#insert_all/2" rel="noopener nofollow ugc">it doesn’t support uniqueness</a>.</p>
<aside class="quote no-group" data-username="amnu3387" data-post="148" data-topic="22449">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/a/ed8c4c/48.png" class="avatar"> amnu3387:</div>
<blockquote>
<p>Thanks for the explanation and samples!</p>
</blockquote>
</aside>
<p>My pleasure! I hope it makes your situation a bit smoother.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="157289" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/oban-reliable-and-observable-job-processing/22449/149">Post #148</a>
	                </div>
	            </div>
              <div id="likers-container-157289" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="157289"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #148"></div>
  </section>
</div>
    <div class="postbit" id="157849" data-post-id="157849">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="AndyL" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/AndyL/120/3659_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  AndyL
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Looks like the cron settings are defined as a config option, parsed at boot time.</p>
<p>Is that right?</p>
<p>Is there a way to update cron settings in a running <code>Oban</code> application?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="157849" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/oban-reliable-and-observable-job-processing/22449/150">Post #149</a>
	                </div>
	            </div>
              <div id="likers-container-157849" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="157849"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #149"></div>
  </section>
</div>
    <div class="postbit" id="157877" data-post-id="157877">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sorentwo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sorentwo/120/37360_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sorentwo
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Oban Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>The short answer is no, there isn’t any way to do that. You could fetch the current config (<code>Oban.config/0</code>) and then update it to put in the new crontab, but that wouldn’t make its way into the scheduler itself.</p>
<p>The only way to do this currently would be to shut down the existing Oban supervisor and then start a new one with updated config.</p>
<p>What is your use case?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="157877" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/oban-reliable-and-observable-job-processing/22449/151">Post #150</a>
	                </div>
	            </div>
              <div id="likers-container-157877" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="157877"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #150"></div>
  </section>
</div>
    <div class="postbit" id="157878" data-post-id="157878">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="AndyL" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/AndyL/120/3659_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  AndyL
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/sorentwo" rel="nofollow">@sorentwo</a> thanks for the helpful info.</p>
<p>Use case: I have a ‘job runner’ Phoenix app similar in concept to Apache Airflow.  The app allow end-users to schedule their own jobs, add and remove jobs, tweak the job execution frequency.  I’m currently doing this with Quantum, and would like to consolidate dependencies.  To make it work on Oban probably I would use a single job-runner module that takes user-specified arguments.</p>
<p>I’m just reading the <code>Crontab.Scheduler</code> source now.  To make this work I might need a custom version of the <code>enqueue_jobs</code> function, or maybe I would tweak the <code>Oban.Config</code> genserver to add an <code>update_crontab</code> function.</p>
<p>If people would like an ‘updatable cronjobs’ feature, give a like and if there is critical mass I’ll submit a PR.  Otherwise I can hack something together that solves my issue.  <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="157878" data-batch-url="/posts/batch_likers">
                        5
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/oban-reliable-and-observable-job-processing/22449/152">Post #151</a>
	                </div>
	            </div>
              <div id="likers-container-157878" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="157878"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #151"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/22449/load_more?page=16">Load more posts (161 remaining)</a>
</div></template></turbo-stream>