Skip to content

Commit 9fc5dc4

Browse files
authored
Merge pull request #667 from nervosnetwork/shaojunda-fix-block-performance
2 parents 2beabee + 783baa7 commit 9fc5dc4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/models/block.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Block < ApplicationRecord
2525
attribute :uncle_block_hashes, :ckb_array_hash, hash_length: ENV["DEFAULT_HASH_LENGTH"]
2626
attribute :proposals, :ckb_array_hash, hash_length: ENV["DEFAULT_SHORT_HASH_LENGTH"]
2727

28-
scope :recent, -> { order(timestamp: :desc) }
28+
scope :recent, -> { order("timestamp desc nulls last") }
2929
scope :created_after, ->(timestamp) { where("timestamp >= ?", timestamp) }
3030
scope :created_before, ->(timestamp) { where("timestamp <= ?", timestamp) }
3131
scope :h24, -> { where("timestamp > ?", 24.hours.ago.to_datetime.strftime("%Q")) }

0 commit comments

Comments
 (0)