File tree Expand file tree Collapse file tree 3 files changed +28
-7
lines changed
Expand file tree Collapse file tree 3 files changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -185,9 +185,8 @@ class Osm2pgsqlProperties:
185185 "Use --start-at to set an explicit date." )
186186
187187 date = from_osm_date (date )
188- if start_at is not None :
189- date -= dt .timedelta (minutes = start_at )
190- seq = None
188+ date -= dt .timedelta (minutes = start_at or 180 )
189+ seq = None
191190 else :
192191 seq = int (seq )
193192
@@ -261,8 +260,7 @@ class LegacyProperties:
261260 except ValueError :
262261 raise DBError (1 , f"Cannot parse timestamp '{ date } '" )
263262
264- if isinstance (start_at , int ):
265- date -= dt .timedelta (minutes = start_at )
263+ date -= dt .timedelta (minutes = start_at or 180 )
266264
267265 return server , None , date
268266
Original file line number Diff line number Diff line change @@ -135,6 +135,29 @@ Feature: Tests for the osm2pgsql-replication script with property table
135135 | replication_timestamp | 2020 -10 -04T03 :30 :00Z |
136136
137137
138+ Scenario : Replication can be initialised from database date
139+ Given the OSM data
140+ """
141+ n34 Tamenity=restaurant x77 y45.3 t2020-10-04T04:00:01Z
142+ """
143+ And the replication service at https://planet.openstreetmap.org/replication/minute
144+ | sequence | timestamp |
145+ | 345 | 2020 -10 -04T01 :00 :00Z |
146+ | 346 | 2020 -10 -04T02 :00 :00Z |
147+ | 347 | 2020 -10 -04T03 :00 :00Z |
148+ When running osm2pgsql pgsql with parameters
149+ | --slim |
150+
151+ And running osm2pgsql-replication
152+ | init |
153+
154+ Then table osm2pgsql_properties contains
155+ | property | value |
156+ | replication_base_url | https ://planet .openstreetmap .org /replication /minute |
157+ | replication_sequence_number | 345 |
158+ | replication_timestamp | 2020 -10 -04T01 :00 :01Z |
159+
160+
138161 Scenario : Replication can be initialised with a rollback (no previous replication info)
139162 Given the OSM data
140163 """
@@ -195,7 +218,7 @@ Feature: Tests for the osm2pgsql-replication script with property table
195218 | property | value |
196219 | replication_base_url | https ://custom .replication |
197220 | replication_sequence_number | 1346 |
198- | replication_timestamp | 2013 -08 -03T15 :55 :30Z |
221+ | replication_timestamp | 2013 -08 -03T12 :55 :30Z |
199222
200223
201224 Scenario : Updates need an initialised replication
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ Feature: Tests for the osm2pgsql-replication script without property table
107107
108108 Then table planet_osm_replication_status contains exactly
109109 | url | sequence | importdate at time zone 'UTC ' |
110- | https ://planet .openstreetmap .org /replication /minute | 346 | 2020 -10 -15 12 :21 :53 |
110+ | https ://planet .openstreetmap .org /replication /minute | 346 | 2020 -10 -15 09 :21 :53 |
111111
112112
113113 Scenario : Replication can be initialised from the data in the database with rollback
You can’t perform that action at this time.
0 commit comments