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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Firstly I would like to thank all the contributor of this project. I have been using it for a while and it’s working great.</p>
<p>I have couple of quick questions to ask which are</p>
<ol>
<li>I see that the primary key of the job table is <code>bigint</code>. My question is that what if I created jobs so much that eventually ran out of the <code>bigint</code>’s valid range. Does Oban provide a mechanism to resolve this issue yet?. Currently I am using customer pruner to remove jobs from the <code>db</code> already but I would like to know if I ran out the valid <code>bigint</code> to create a primary key what could happen?</li>
<li>currently I am using oban on the distributed nodes. I am having issues to set the cron, to uniquely run a single long running task across nodes, And I want to make sure that until a job is completed the new job should not be scheduled, I am using oban <code>cronjob</code> machanism to do this.</li>
</ol>
<p>This is what my job module looks like → </p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># My Job Module
defmodule MyApp.Job do
  use Oban.Worker,
    queue: :worker1,
    unique: [
      fields: [:args],
      states: [:available, :scheduled, :executing],
      period: 60
    ]
 
  def perform(_) do
  end
end

# My cron configuration in config
config :my_app, Oban,
  repo: My.Repo,
  queues: [worker1: 1],
  crontab: [
    {"* * * * *", MyApp.Job}
  ]
</code></pre>
<p>With this configuration, I could see that new job is never scheduled until the current job is finished. But I am seeing that the new job is created before a time diff of 1 minute. One more thing to note is that this job could be running for small time or it could run for serveral minutes. I want to guarantee two things → 1. only 1 job can be run at a time on distributed nodes, and 2. I want to gurantee that a new job should not be created before 1 minute</p>
<p>Thanks<br>
Suracheth</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="193261" 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/233">Post #232</a>
	                </div>
	            </div>
              <div id="likers-container-193261" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="193261"
                     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 #232"></div>
  </section>
</div>
    <div class="postbit" id="193263" data-post-id="193263">
  <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 quote-modified" data-username="blisscs" data-post="233" 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/b/e95f7d/48.png" class="avatar"> blisscs:</div>
<blockquote>
<p>I see that the primary key of the job table is <code>bigint</code> . My question is that what if I created jobs so much that eventually ran out of the <code>bigint</code> 's valid range. Does Oban provide a mechanism to resolve this issue yet?. Currently I am using customer pruner to remove jobs from the <code>db</code> already but I would like to know if I ran out the valid <code>bigint</code> to create a primary key what could happen?</p>
</blockquote>
</aside>
<p>The upper bound of a PG bigint/bigserial is 9,223,372,036,854,775,807. That will last a <em>really</em> long time—if you are running 5 million jobs a day it would take 5,053,902,485 years to exhaust exhaust the limit. If, somehow, you’re running enough jobs that this is a practical concern you can reset the pkey back to 1:</p>
<pre data-code-wrap="sql"><code class="lang-sql">ALTER SEQUENCE oban_jobs_id_seq RESTART WITH 1
</code></pre>
<p>As long as you are pruning jobs and the rate of inserting new jobs won’t collide with existing jobs, this is entirely safe to do. Practically, you’ll never need to worry about it.</p>
<aside class="quote no-group" data-username="blisscs" data-post="233" 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/b/e95f7d/48.png" class="avatar"> blisscs:</div>
<blockquote>
<p>currently I am using oban on the distributed nodes. I am having issues to set the cron, to uniquely run a single long running task across nodes, And I want to make sure that until a job is completed the new job should not be scheduled, I am using oban <code>cronjob</code> machanism to do this.</p>
</blockquote>
</aside>
<p>So long as you don’t override the unique <code>:stats</code> this is the default behavior. If the job is taking more than a minute, and it is still executing, a new job won’t be inserted. The cron scheduler does not execute jobs inline, instead it inserts a single job across all distributed nodes, and that job will only run on a single node.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="193263" data-batch-url="/posts/batch_likers">
                        3
                      </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/234">Post #233</a>
	                </div>
	            </div>
              <div id="likers-container-193263" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="193263"
                     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 #233"></div>
  </section>
</div>
    <div class="postbit" id="193264" data-post-id="193264">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="blisscs" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  blisscs
                  </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 your reply. so for the my above unique job case. if i do not override the <code>:states</code>, i should capture what i needed.</p>
<p>My intention of overriding startes above is that i don’t want to discard and do not count for completed jobs for checking uniqueness.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="193264" 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/235">Post #234</a>
	                </div>
	            </div>
              <div id="likers-container-193264" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="193264"
                     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 #234"></div>
  </section>
</div>
    <div class="postbit" id="232049" data-post-id="232049">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi,<br>
I like Oban. I wonder, is it supported to give a string as error in the {:error, reason} tuple.<br>
If not, what format should reason be in?<br>
Thanks!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="232049" 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/236">Post #235</a>
	                </div>
	            </div>
              <div id="likers-container-232049" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="232049"
                     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 #235"></div>
  </section>
</div>
    <div class="postbit" id="232051" data-post-id="232051">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/smolcatgirl" rel="nofollow">@smolcatgirl</a>, error reason <a href="https://hexdocs.pm/oban/Oban.Worker.html#t:result/0" rel="noopener nofollow ugc">can be any term</a>, so yeah, you can use a string.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="232051" 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/237">Post #236</a>
	                </div>
	            </div>
              <div id="likers-container-232051" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="232051"
                     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 #236"></div>
  </section>
</div>
    <div class="postbit" id="232070" data-post-id="232070">
  <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>As <a class="mention" href="/u/smaximov" rel="nofollow">@smaximov</a> said, any value is accepted for the error reason.</p>
<p>You can see the <a href="https://hexdocs.pm/oban/Oban.Worker.html#t:result/0" rel="noopener nofollow ugc">result spec here</a>, and the docs for the <a href="https://hexdocs.pm/oban/Oban.PerformError.html#content" rel="noopener nofollow ugc">PerformError</a> that wraps the error reason when it isn’t an exception.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="232070" 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/238">Post #237</a>
	                </div>
	            </div>
              <div id="likers-container-232070" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="232070"
                     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 #237"></div>
  </section>
</div>
    <div class="postbit" id="232091" data-post-id="232091">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hello,</p>
<p>I need to list all running queues on a node. For now this is what I am doing:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  def list_running_queues do
    Registry.select(Oban.Registry, [{{{Oban, {:producer, :"$1"}}, :_, :_}, [], [:"$1"]}])
  end
</code></pre>
<p>It seems to work, but is that even correct?</p>
<p>Is there better way that does not require to know how Oban registers its workers?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="232091" 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/239">Post #238</a>
	                </div>
	            </div>
              <div id="likers-container-232091" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="232091"
                     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 #238"></div>
  </section>
</div>
    <div class="postbit" id="232157" data-post-id="232157">
  <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="lud" data-post="239" data-topic="22449">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lud/48/14382_2.png" class="avatar"> lud:</div>
<blockquote>
<p>It seems to work, but is that even correct?</p>
</blockquote>
</aside>
<p>That looks correct. The best example I have is in <a href="https://github.com/sorentwo/oban/blob/main/lib/oban/plugins/repeater.ex#L51" rel="noopener nofollow ugc">the repeater plugin</a>.</p>
<aside class="quote no-group" data-username="lud" data-post="239" data-topic="22449">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lud/48/14382_2.png" class="avatar"> lud:</div>
<blockquote>
<p>Is there better way that does not require to know how Oban registers its workers?</p>
</blockquote>
</aside>
<p>No, there isn’t a different (or better) way to list all running queues.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="232157" 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/240">Post #239</a>
	                </div>
	            </div>
              <div id="likers-container-232157" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="232157"
                     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 #239"></div>
  </section>
</div>
    <div class="postbit" id="232159" data-post-id="232159">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thank you <a class="mention" href="/u/sorentwo" rel="nofollow">@sorentwo</a> <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" 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="232159" 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/241">Post #240</a>
	                </div>
	            </div>
              <div id="likers-container-232159" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="232159"
                     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 #240"></div>
  </section>
</div>
    <div class="postbit" id="239637" data-post-id="239637">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>This week the course <a href="https://nateberk.gumroad.com/l/sidekiqinpractice" rel="noopener nofollow ugc">Sidekiq in Practice</a> is available <a href="https://www.mikeperham.com/2022/01/17/happy-10th-birthday-sidekiq/" rel="noopener nofollow ugc">for 5$</a> (it costs 50$ normally).</p>
<p>Looks like the sections about scaling and idempotency may be interesting regardless of the background job framework you are using. Does anyone have an opinion on this course or know if some of the lessons can be applied to Oban as well?</p>
<p>EDIT: don’t have any personal or professional affiliation with the course or with Sidekiq. Just used it in a Rails project and found it incredibly stable and well written piece of software.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="239637" 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/242">Post #241</a>
	                </div>
	            </div>
              <div id="likers-container-239637" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="239637"
                     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 #241"></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=25">Load more posts (71 remaining)</a>
</div></template></turbo-stream>